
obj/user/testpiperace.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 c1 01 00 00       	call   8001f2 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <umain>:
#include <inc/lib.h>

void
umain(int argc, char **argv)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	56                   	push   %esi
  80003b:	53                   	push   %ebx
  80003c:	83 ec 1c             	sub    $0x1c,%esp
	int p[2], r, pid, i, max;
	void *va;
	struct Fd *fd;
	const volatile struct Env *kid;

	cprintf("testing for dup race...\n");
  80003f:	68 60 24 80 00       	push   $0x802460
  800044:	e8 02 03 00 00       	call   80034b <cprintf>
	if ((r = pipe(p)) < 0)
  800049:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80004c:	89 04 24             	mov    %eax,(%esp)
  80004f:	e8 e5 1d 00 00       	call   801e39 <pipe>
  800054:	83 c4 10             	add    $0x10,%esp
  800057:	85 c0                	test   %eax,%eax
  800059:	78 59                	js     8000b4 <umain+0x81>
		panic("pipe: %e", r);
	max = 200;
	if ((r = fork()) < 0)
  80005b:	e8 3d 10 00 00       	call   80109d <fork>
  800060:	89 c6                	mov    %eax,%esi
  800062:	85 c0                	test   %eax,%eax
  800064:	78 60                	js     8000c6 <umain+0x93>
		panic("fork: %e", r);
	if (r == 0) {
  800066:	74 70                	je     8000d8 <umain+0xa5>
		}
		// do something to be not runnable besides exiting
		ipc_recv(0,0,0);
	}
	pid = r;
	cprintf("pid is %d\n", pid);
  800068:	83 ec 08             	sub    $0x8,%esp
  80006b:	56                   	push   %esi
  80006c:	68 ba 24 80 00       	push   $0x8024ba
  800071:	e8 d5 02 00 00       	call   80034b <cprintf>
	va = 0;
	kid = &envs[ENVX(pid)];
  800076:	81 e6 ff 03 00 00    	and    $0x3ff,%esi
	cprintf("kid is %d\n", kid-envs);
  80007c:	83 c4 08             	add    $0x8,%esp
  80007f:	6b c6 7c             	imul   $0x7c,%esi,%eax
  800082:	c1 f8 02             	sar    $0x2,%eax
  800085:	69 c0 df 7b ef bd    	imul   $0xbdef7bdf,%eax,%eax
  80008b:	50                   	push   %eax
  80008c:	68 c5 24 80 00       	push   $0x8024c5
  800091:	e8 b5 02 00 00       	call   80034b <cprintf>
	dup(p[0], 10);
  800096:	83 c4 08             	add    $0x8,%esp
  800099:	6a 0a                	push   $0xa
  80009b:	ff 75 f0             	pushl  -0x10(%ebp)
  80009e:	e8 43 15 00 00       	call   8015e6 <dup>
	while (kid->env_status == ENV_RUNNABLE)
  8000a3:	83 c4 10             	add    $0x10,%esp
  8000a6:	6b de 7c             	imul   $0x7c,%esi,%ebx
  8000a9:	81 c3 00 00 c0 ee    	add    $0xeec00000,%ebx
  8000af:	e9 92 00 00 00       	jmp    800146 <umain+0x113>
		panic("pipe: %e", r);
  8000b4:	50                   	push   %eax
  8000b5:	68 79 24 80 00       	push   $0x802479
  8000ba:	6a 0d                	push   $0xd
  8000bc:	68 82 24 80 00       	push   $0x802482
  8000c1:	e8 9e 01 00 00       	call   800264 <_panic>
		panic("fork: %e", r);
  8000c6:	50                   	push   %eax
  8000c7:	68 96 24 80 00       	push   $0x802496
  8000cc:	6a 10                	push   $0x10
  8000ce:	68 82 24 80 00       	push   $0x802482
  8000d3:	e8 8c 01 00 00       	call   800264 <_panic>
		close(p[1]);
  8000d8:	83 ec 0c             	sub    $0xc,%esp
  8000db:	ff 75 f4             	pushl  -0xc(%ebp)
  8000de:	e8 a9 14 00 00       	call   80158c <close>
  8000e3:	83 c4 10             	add    $0x10,%esp
  8000e6:	bb c8 00 00 00       	mov    $0xc8,%ebx
  8000eb:	eb 1f                	jmp    80010c <umain+0xd9>
				cprintf("RACE: pipe appears closed\n");
  8000ed:	83 ec 0c             	sub    $0xc,%esp
  8000f0:	68 9f 24 80 00       	push   $0x80249f
  8000f5:	e8 51 02 00 00       	call   80034b <cprintf>
				exit();
  8000fa:	e8 47 01 00 00       	call   800246 <exit>
  8000ff:	83 c4 10             	add    $0x10,%esp
			sys_yield();
  800102:	e8 3c 0c 00 00       	call   800d43 <sys_yield>
		for (i=0; i<max; i++) {
  800107:	83 eb 01             	sub    $0x1,%ebx
  80010a:	74 14                	je     800120 <umain+0xed>
			if(pipeisclosed(p[0])){
  80010c:	83 ec 0c             	sub    $0xc,%esp
  80010f:	ff 75 f0             	pushl  -0x10(%ebp)
  800112:	e8 70 1e 00 00       	call   801f87 <pipeisclosed>
  800117:	83 c4 10             	add    $0x10,%esp
  80011a:	85 c0                	test   %eax,%eax
  80011c:	74 e4                	je     800102 <umain+0xcf>
  80011e:	eb cd                	jmp    8000ed <umain+0xba>
		ipc_recv(0,0,0);
  800120:	83 ec 04             	sub    $0x4,%esp
  800123:	6a 00                	push   $0x0
  800125:	6a 00                	push   $0x0
  800127:	6a 00                	push   $0x0
  800129:	e8 8a 11 00 00       	call   8012b8 <ipc_recv>
  80012e:	83 c4 10             	add    $0x10,%esp
  800131:	e9 32 ff ff ff       	jmp    800068 <umain+0x35>
		dup(p[0], 10);
  800136:	83 ec 08             	sub    $0x8,%esp
  800139:	6a 0a                	push   $0xa
  80013b:	ff 75 f0             	pushl  -0x10(%ebp)
  80013e:	e8 a3 14 00 00       	call   8015e6 <dup>
  800143:	83 c4 10             	add    $0x10,%esp
	while (kid->env_status == ENV_RUNNABLE)
  800146:	8b 43 54             	mov    0x54(%ebx),%eax
  800149:	83 f8 02             	cmp    $0x2,%eax
  80014c:	74 e8                	je     800136 <umain+0x103>

	cprintf("child done with loop\n");
  80014e:	83 ec 0c             	sub    $0xc,%esp
  800151:	68 d0 24 80 00       	push   $0x8024d0
  800156:	e8 f0 01 00 00       	call   80034b <cprintf>
	if (pipeisclosed(p[0]))
  80015b:	83 c4 04             	add    $0x4,%esp
  80015e:	ff 75 f0             	pushl  -0x10(%ebp)
  800161:	e8 21 1e 00 00       	call   801f87 <pipeisclosed>
  800166:	83 c4 10             	add    $0x10,%esp
  800169:	85 c0                	test   %eax,%eax
  80016b:	75 48                	jne    8001b5 <umain+0x182>
		panic("somehow the other end of p[0] got closed!");
	if ((r = fd_lookup(p[0], &fd)) < 0)
  80016d:	83 ec 08             	sub    $0x8,%esp
  800170:	8d 45 ec             	lea    -0x14(%ebp),%eax
  800173:	50                   	push   %eax
  800174:	ff 75 f0             	pushl  -0x10(%ebp)
  800177:	e8 d7 12 00 00       	call   801453 <fd_lookup>
  80017c:	83 c4 10             	add    $0x10,%esp
  80017f:	85 c0                	test   %eax,%eax
  800181:	78 46                	js     8001c9 <umain+0x196>
		panic("cannot look up p[0]: %e", r);
	va = fd2data(fd);
  800183:	83 ec 0c             	sub    $0xc,%esp
  800186:	ff 75 ec             	pushl  -0x14(%ebp)
  800189:	e8 54 12 00 00       	call   8013e2 <fd2data>
	if (pageref(va) != 3+1)
  80018e:	89 04 24             	mov    %eax,(%esp)
  800191:	e8 82 1a 00 00       	call   801c18 <pageref>
  800196:	83 c4 10             	add    $0x10,%esp
  800199:	83 f8 04             	cmp    $0x4,%eax
  80019c:	74 3d                	je     8001db <umain+0x1a8>
		cprintf("\nchild detected race\n");
  80019e:	83 ec 0c             	sub    $0xc,%esp
  8001a1:	68 fe 24 80 00       	push   $0x8024fe
  8001a6:	e8 a0 01 00 00       	call   80034b <cprintf>
  8001ab:	83 c4 10             	add    $0x10,%esp
	else
		cprintf("\nrace didn't happen\n", max);
}
  8001ae:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8001b1:	5b                   	pop    %ebx
  8001b2:	5e                   	pop    %esi
  8001b3:	5d                   	pop    %ebp
  8001b4:	c3                   	ret    
		panic("somehow the other end of p[0] got closed!");
  8001b5:	83 ec 04             	sub    $0x4,%esp
  8001b8:	68 2c 25 80 00       	push   $0x80252c
  8001bd:	6a 3a                	push   $0x3a
  8001bf:	68 82 24 80 00       	push   $0x802482
  8001c4:	e8 9b 00 00 00       	call   800264 <_panic>
		panic("cannot look up p[0]: %e", r);
  8001c9:	50                   	push   %eax
  8001ca:	68 e6 24 80 00       	push   $0x8024e6
  8001cf:	6a 3c                	push   $0x3c
  8001d1:	68 82 24 80 00       	push   $0x802482
  8001d6:	e8 89 00 00 00       	call   800264 <_panic>
		cprintf("\nrace didn't happen\n", max);
  8001db:	83 ec 08             	sub    $0x8,%esp
  8001de:	68 c8 00 00 00       	push   $0xc8
  8001e3:	68 14 25 80 00       	push   $0x802514
  8001e8:	e8 5e 01 00 00       	call   80034b <cprintf>
  8001ed:	83 c4 10             	add    $0x10,%esp
}
  8001f0:	eb bc                	jmp    8001ae <umain+0x17b>

008001f2 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8001f2:	f3 0f 1e fb          	endbr32 
  8001f6:	55                   	push   %ebp
  8001f7:	89 e5                	mov    %esp,%ebp
  8001f9:	56                   	push   %esi
  8001fa:	53                   	push   %ebx
  8001fb:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8001fe:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  800201:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  800208:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  80020b:	e8 10 0b 00 00       	call   800d20 <sys_getenvid>
  800210:	25 ff 03 00 00       	and    $0x3ff,%eax
  800215:	6b c0 7c             	imul   $0x7c,%eax,%eax
  800218:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  80021d:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  800222:	85 db                	test   %ebx,%ebx
  800224:	7e 07                	jle    80022d <libmain+0x3b>
		binaryname = argv[0];
  800226:	8b 06                	mov    (%esi),%eax
  800228:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  80022d:	83 ec 08             	sub    $0x8,%esp
  800230:	56                   	push   %esi
  800231:	53                   	push   %ebx
  800232:	e8 fc fd ff ff       	call   800033 <umain>

	// exit gracefully
	exit();
  800237:	e8 0a 00 00 00       	call   800246 <exit>
}
  80023c:	83 c4 10             	add    $0x10,%esp
  80023f:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800242:	5b                   	pop    %ebx
  800243:	5e                   	pop    %esi
  800244:	5d                   	pop    %ebp
  800245:	c3                   	ret    

00800246 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  800246:	f3 0f 1e fb          	endbr32 
  80024a:	55                   	push   %ebp
  80024b:	89 e5                	mov    %esp,%ebp
  80024d:	83 ec 08             	sub    $0x8,%esp
	close_all();
  800250:	e8 68 13 00 00       	call   8015bd <close_all>
	sys_env_destroy(0);
  800255:	83 ec 0c             	sub    $0xc,%esp
  800258:	6a 00                	push   $0x0
  80025a:	e8 7c 0a 00 00       	call   800cdb <sys_env_destroy>
}
  80025f:	83 c4 10             	add    $0x10,%esp
  800262:	c9                   	leave  
  800263:	c3                   	ret    

00800264 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  800264:	f3 0f 1e fb          	endbr32 
  800268:	55                   	push   %ebp
  800269:	89 e5                	mov    %esp,%ebp
  80026b:	56                   	push   %esi
  80026c:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  80026d:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  800270:	8b 35 00 30 80 00    	mov    0x803000,%esi
  800276:	e8 a5 0a 00 00       	call   800d20 <sys_getenvid>
  80027b:	83 ec 0c             	sub    $0xc,%esp
  80027e:	ff 75 0c             	pushl  0xc(%ebp)
  800281:	ff 75 08             	pushl  0x8(%ebp)
  800284:	56                   	push   %esi
  800285:	50                   	push   %eax
  800286:	68 60 25 80 00       	push   $0x802560
  80028b:	e8 bb 00 00 00       	call   80034b <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  800290:	83 c4 18             	add    $0x18,%esp
  800293:	53                   	push   %ebx
  800294:	ff 75 10             	pushl  0x10(%ebp)
  800297:	e8 5a 00 00 00       	call   8002f6 <vcprintf>
	cprintf("\n");
  80029c:	c7 04 24 77 24 80 00 	movl   $0x802477,(%esp)
  8002a3:	e8 a3 00 00 00       	call   80034b <cprintf>
  8002a8:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  8002ab:	cc                   	int3   
  8002ac:	eb fd                	jmp    8002ab <_panic+0x47>

008002ae <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  8002ae:	f3 0f 1e fb          	endbr32 
  8002b2:	55                   	push   %ebp
  8002b3:	89 e5                	mov    %esp,%ebp
  8002b5:	53                   	push   %ebx
  8002b6:	83 ec 04             	sub    $0x4,%esp
  8002b9:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  8002bc:	8b 13                	mov    (%ebx),%edx
  8002be:	8d 42 01             	lea    0x1(%edx),%eax
  8002c1:	89 03                	mov    %eax,(%ebx)
  8002c3:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8002c6:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  8002ca:	3d ff 00 00 00       	cmp    $0xff,%eax
  8002cf:	74 09                	je     8002da <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  8002d1:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  8002d5:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8002d8:	c9                   	leave  
  8002d9:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  8002da:	83 ec 08             	sub    $0x8,%esp
  8002dd:	68 ff 00 00 00       	push   $0xff
  8002e2:	8d 43 08             	lea    0x8(%ebx),%eax
  8002e5:	50                   	push   %eax
  8002e6:	e8 ab 09 00 00       	call   800c96 <sys_cputs>
		b->idx = 0;
  8002eb:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8002f1:	83 c4 10             	add    $0x10,%esp
  8002f4:	eb db                	jmp    8002d1 <putch+0x23>

008002f6 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  8002f6:	f3 0f 1e fb          	endbr32 
  8002fa:	55                   	push   %ebp
  8002fb:	89 e5                	mov    %esp,%ebp
  8002fd:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  800303:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  80030a:	00 00 00 
	b.cnt = 0;
  80030d:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  800314:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  800317:	ff 75 0c             	pushl  0xc(%ebp)
  80031a:	ff 75 08             	pushl  0x8(%ebp)
  80031d:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  800323:	50                   	push   %eax
  800324:	68 ae 02 80 00       	push   $0x8002ae
  800329:	e8 20 01 00 00       	call   80044e <vprintfmt>
	sys_cputs(b.buf, b.idx);
  80032e:	83 c4 08             	add    $0x8,%esp
  800331:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  800337:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  80033d:	50                   	push   %eax
  80033e:	e8 53 09 00 00       	call   800c96 <sys_cputs>

	return b.cnt;
}
  800343:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  800349:	c9                   	leave  
  80034a:	c3                   	ret    

0080034b <cprintf>:

int
cprintf(const char *fmt, ...)
{
  80034b:	f3 0f 1e fb          	endbr32 
  80034f:	55                   	push   %ebp
  800350:	89 e5                	mov    %esp,%ebp
  800352:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  800355:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  800358:	50                   	push   %eax
  800359:	ff 75 08             	pushl  0x8(%ebp)
  80035c:	e8 95 ff ff ff       	call   8002f6 <vcprintf>
	va_end(ap);

	return cnt;
}
  800361:	c9                   	leave  
  800362:	c3                   	ret    

00800363 <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  800363:	55                   	push   %ebp
  800364:	89 e5                	mov    %esp,%ebp
  800366:	57                   	push   %edi
  800367:	56                   	push   %esi
  800368:	53                   	push   %ebx
  800369:	83 ec 1c             	sub    $0x1c,%esp
  80036c:	89 c7                	mov    %eax,%edi
  80036e:	89 d6                	mov    %edx,%esi
  800370:	8b 45 08             	mov    0x8(%ebp),%eax
  800373:	8b 55 0c             	mov    0xc(%ebp),%edx
  800376:	89 d1                	mov    %edx,%ecx
  800378:	89 c2                	mov    %eax,%edx
  80037a:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80037d:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800380:	8b 45 10             	mov    0x10(%ebp),%eax
  800383:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800386:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800389:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  800390:	39 c2                	cmp    %eax,%edx
  800392:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800395:	72 3e                	jb     8003d5 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  800397:	83 ec 0c             	sub    $0xc,%esp
  80039a:	ff 75 18             	pushl  0x18(%ebp)
  80039d:	83 eb 01             	sub    $0x1,%ebx
  8003a0:	53                   	push   %ebx
  8003a1:	50                   	push   %eax
  8003a2:	83 ec 08             	sub    $0x8,%esp
  8003a5:	ff 75 e4             	pushl  -0x1c(%ebp)
  8003a8:	ff 75 e0             	pushl  -0x20(%ebp)
  8003ab:	ff 75 dc             	pushl  -0x24(%ebp)
  8003ae:	ff 75 d8             	pushl  -0x28(%ebp)
  8003b1:	e8 4a 1e 00 00       	call   802200 <__udivdi3>
  8003b6:	83 c4 18             	add    $0x18,%esp
  8003b9:	52                   	push   %edx
  8003ba:	50                   	push   %eax
  8003bb:	89 f2                	mov    %esi,%edx
  8003bd:	89 f8                	mov    %edi,%eax
  8003bf:	e8 9f ff ff ff       	call   800363 <printnum>
  8003c4:	83 c4 20             	add    $0x20,%esp
  8003c7:	eb 13                	jmp    8003dc <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  8003c9:	83 ec 08             	sub    $0x8,%esp
  8003cc:	56                   	push   %esi
  8003cd:	ff 75 18             	pushl  0x18(%ebp)
  8003d0:	ff d7                	call   *%edi
  8003d2:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  8003d5:	83 eb 01             	sub    $0x1,%ebx
  8003d8:	85 db                	test   %ebx,%ebx
  8003da:	7f ed                	jg     8003c9 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  8003dc:	83 ec 08             	sub    $0x8,%esp
  8003df:	56                   	push   %esi
  8003e0:	83 ec 04             	sub    $0x4,%esp
  8003e3:	ff 75 e4             	pushl  -0x1c(%ebp)
  8003e6:	ff 75 e0             	pushl  -0x20(%ebp)
  8003e9:	ff 75 dc             	pushl  -0x24(%ebp)
  8003ec:	ff 75 d8             	pushl  -0x28(%ebp)
  8003ef:	e8 1c 1f 00 00       	call   802310 <__umoddi3>
  8003f4:	83 c4 14             	add    $0x14,%esp
  8003f7:	0f be 80 83 25 80 00 	movsbl 0x802583(%eax),%eax
  8003fe:	50                   	push   %eax
  8003ff:	ff d7                	call   *%edi
}
  800401:	83 c4 10             	add    $0x10,%esp
  800404:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800407:	5b                   	pop    %ebx
  800408:	5e                   	pop    %esi
  800409:	5f                   	pop    %edi
  80040a:	5d                   	pop    %ebp
  80040b:	c3                   	ret    

0080040c <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  80040c:	f3 0f 1e fb          	endbr32 
  800410:	55                   	push   %ebp
  800411:	89 e5                	mov    %esp,%ebp
  800413:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  800416:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  80041a:	8b 10                	mov    (%eax),%edx
  80041c:	3b 50 04             	cmp    0x4(%eax),%edx
  80041f:	73 0a                	jae    80042b <sprintputch+0x1f>
		*b->buf++ = ch;
  800421:	8d 4a 01             	lea    0x1(%edx),%ecx
  800424:	89 08                	mov    %ecx,(%eax)
  800426:	8b 45 08             	mov    0x8(%ebp),%eax
  800429:	88 02                	mov    %al,(%edx)
}
  80042b:	5d                   	pop    %ebp
  80042c:	c3                   	ret    

0080042d <printfmt>:
{
  80042d:	f3 0f 1e fb          	endbr32 
  800431:	55                   	push   %ebp
  800432:	89 e5                	mov    %esp,%ebp
  800434:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  800437:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  80043a:	50                   	push   %eax
  80043b:	ff 75 10             	pushl  0x10(%ebp)
  80043e:	ff 75 0c             	pushl  0xc(%ebp)
  800441:	ff 75 08             	pushl  0x8(%ebp)
  800444:	e8 05 00 00 00       	call   80044e <vprintfmt>
}
  800449:	83 c4 10             	add    $0x10,%esp
  80044c:	c9                   	leave  
  80044d:	c3                   	ret    

0080044e <vprintfmt>:
{
  80044e:	f3 0f 1e fb          	endbr32 
  800452:	55                   	push   %ebp
  800453:	89 e5                	mov    %esp,%ebp
  800455:	57                   	push   %edi
  800456:	56                   	push   %esi
  800457:	53                   	push   %ebx
  800458:	83 ec 3c             	sub    $0x3c,%esp
  80045b:	8b 75 08             	mov    0x8(%ebp),%esi
  80045e:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  800461:	8b 7d 10             	mov    0x10(%ebp),%edi
  800464:	e9 5d 03 00 00       	jmp    8007c6 <vprintfmt+0x378>
		padc = ' ';
  800469:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  80046d:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  800474:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  80047b:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  800482:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800487:	8d 47 01             	lea    0x1(%edi),%eax
  80048a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80048d:	0f b6 17             	movzbl (%edi),%edx
  800490:	8d 42 dd             	lea    -0x23(%edx),%eax
  800493:	3c 55                	cmp    $0x55,%al
  800495:	0f 87 ae 03 00 00    	ja     800849 <vprintfmt+0x3fb>
  80049b:	0f b6 c0             	movzbl %al,%eax
  80049e:	3e ff 24 85 c0 26 80 	notrack jmp *0x8026c0(,%eax,4)
  8004a5:	00 
  8004a6:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  8004a9:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  8004ad:	eb d8                	jmp    800487 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8004af:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  8004b2:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  8004b6:	eb cf                	jmp    800487 <vprintfmt+0x39>
  8004b8:	0f b6 d2             	movzbl %dl,%edx
  8004bb:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  8004be:	b8 00 00 00 00       	mov    $0x0,%eax
  8004c3:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  8004c6:	8d 04 80             	lea    (%eax,%eax,4),%eax
  8004c9:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  8004cd:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  8004d0:	8d 4a d0             	lea    -0x30(%edx),%ecx
  8004d3:	83 f9 09             	cmp    $0x9,%ecx
  8004d6:	77 55                	ja     80052d <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  8004d8:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  8004db:	eb e9                	jmp    8004c6 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  8004dd:	8b 45 14             	mov    0x14(%ebp),%eax
  8004e0:	8b 00                	mov    (%eax),%eax
  8004e2:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8004e5:	8b 45 14             	mov    0x14(%ebp),%eax
  8004e8:	8d 40 04             	lea    0x4(%eax),%eax
  8004eb:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8004ee:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  8004f1:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8004f5:	79 90                	jns    800487 <vprintfmt+0x39>
				width = precision, precision = -1;
  8004f7:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8004fa:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8004fd:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  800504:	eb 81                	jmp    800487 <vprintfmt+0x39>
  800506:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  800509:	85 c0                	test   %eax,%eax
  80050b:	ba 00 00 00 00       	mov    $0x0,%edx
  800510:	0f 49 d0             	cmovns %eax,%edx
  800513:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  800516:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800519:	e9 69 ff ff ff       	jmp    800487 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80051e:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  800521:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  800528:	e9 5a ff ff ff       	jmp    800487 <vprintfmt+0x39>
  80052d:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  800530:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800533:	eb bc                	jmp    8004f1 <vprintfmt+0xa3>
			lflag++;
  800535:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800538:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  80053b:	e9 47 ff ff ff       	jmp    800487 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  800540:	8b 45 14             	mov    0x14(%ebp),%eax
  800543:	8d 78 04             	lea    0x4(%eax),%edi
  800546:	83 ec 08             	sub    $0x8,%esp
  800549:	53                   	push   %ebx
  80054a:	ff 30                	pushl  (%eax)
  80054c:	ff d6                	call   *%esi
			break;
  80054e:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  800551:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  800554:	e9 6a 02 00 00       	jmp    8007c3 <vprintfmt+0x375>
			err = va_arg(ap, int);
  800559:	8b 45 14             	mov    0x14(%ebp),%eax
  80055c:	8d 78 04             	lea    0x4(%eax),%edi
  80055f:	8b 00                	mov    (%eax),%eax
  800561:	99                   	cltd   
  800562:	31 d0                	xor    %edx,%eax
  800564:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  800566:	83 f8 0f             	cmp    $0xf,%eax
  800569:	7f 23                	jg     80058e <vprintfmt+0x140>
  80056b:	8b 14 85 20 28 80 00 	mov    0x802820(,%eax,4),%edx
  800572:	85 d2                	test   %edx,%edx
  800574:	74 18                	je     80058e <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800576:	52                   	push   %edx
  800577:	68 c1 2a 80 00       	push   $0x802ac1
  80057c:	53                   	push   %ebx
  80057d:	56                   	push   %esi
  80057e:	e8 aa fe ff ff       	call   80042d <printfmt>
  800583:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800586:	89 7d 14             	mov    %edi,0x14(%ebp)
  800589:	e9 35 02 00 00       	jmp    8007c3 <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  80058e:	50                   	push   %eax
  80058f:	68 9b 25 80 00       	push   $0x80259b
  800594:	53                   	push   %ebx
  800595:	56                   	push   %esi
  800596:	e8 92 fe ff ff       	call   80042d <printfmt>
  80059b:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80059e:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  8005a1:	e9 1d 02 00 00       	jmp    8007c3 <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  8005a6:	8b 45 14             	mov    0x14(%ebp),%eax
  8005a9:	83 c0 04             	add    $0x4,%eax
  8005ac:	89 45 c8             	mov    %eax,-0x38(%ebp)
  8005af:	8b 45 14             	mov    0x14(%ebp),%eax
  8005b2:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  8005b4:	85 d2                	test   %edx,%edx
  8005b6:	b8 94 25 80 00       	mov    $0x802594,%eax
  8005bb:	0f 45 c2             	cmovne %edx,%eax
  8005be:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  8005c1:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8005c5:	7e 06                	jle    8005cd <vprintfmt+0x17f>
  8005c7:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  8005cb:	75 0d                	jne    8005da <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  8005cd:	8b 45 cc             	mov    -0x34(%ebp),%eax
  8005d0:	89 c7                	mov    %eax,%edi
  8005d2:	03 45 d4             	add    -0x2c(%ebp),%eax
  8005d5:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8005d8:	eb 55                	jmp    80062f <vprintfmt+0x1e1>
  8005da:	83 ec 08             	sub    $0x8,%esp
  8005dd:	ff 75 d8             	pushl  -0x28(%ebp)
  8005e0:	ff 75 cc             	pushl  -0x34(%ebp)
  8005e3:	e8 15 03 00 00       	call   8008fd <strnlen>
  8005e8:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  8005eb:	29 c2                	sub    %eax,%edx
  8005ed:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  8005f0:	83 c4 10             	add    $0x10,%esp
  8005f3:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  8005f5:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  8005f9:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  8005fc:	85 ff                	test   %edi,%edi
  8005fe:	7e 11                	jle    800611 <vprintfmt+0x1c3>
					putch(padc, putdat);
  800600:	83 ec 08             	sub    $0x8,%esp
  800603:	53                   	push   %ebx
  800604:	ff 75 d4             	pushl  -0x2c(%ebp)
  800607:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  800609:	83 ef 01             	sub    $0x1,%edi
  80060c:	83 c4 10             	add    $0x10,%esp
  80060f:	eb eb                	jmp    8005fc <vprintfmt+0x1ae>
  800611:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  800614:	85 d2                	test   %edx,%edx
  800616:	b8 00 00 00 00       	mov    $0x0,%eax
  80061b:	0f 49 c2             	cmovns %edx,%eax
  80061e:	29 c2                	sub    %eax,%edx
  800620:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  800623:	eb a8                	jmp    8005cd <vprintfmt+0x17f>
					putch(ch, putdat);
  800625:	83 ec 08             	sub    $0x8,%esp
  800628:	53                   	push   %ebx
  800629:	52                   	push   %edx
  80062a:	ff d6                	call   *%esi
  80062c:	83 c4 10             	add    $0x10,%esp
  80062f:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  800632:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  800634:	83 c7 01             	add    $0x1,%edi
  800637:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  80063b:	0f be d0             	movsbl %al,%edx
  80063e:	85 d2                	test   %edx,%edx
  800640:	74 4b                	je     80068d <vprintfmt+0x23f>
  800642:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800646:	78 06                	js     80064e <vprintfmt+0x200>
  800648:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  80064c:	78 1e                	js     80066c <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  80064e:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  800652:	74 d1                	je     800625 <vprintfmt+0x1d7>
  800654:	0f be c0             	movsbl %al,%eax
  800657:	83 e8 20             	sub    $0x20,%eax
  80065a:	83 f8 5e             	cmp    $0x5e,%eax
  80065d:	76 c6                	jbe    800625 <vprintfmt+0x1d7>
					putch('?', putdat);
  80065f:	83 ec 08             	sub    $0x8,%esp
  800662:	53                   	push   %ebx
  800663:	6a 3f                	push   $0x3f
  800665:	ff d6                	call   *%esi
  800667:	83 c4 10             	add    $0x10,%esp
  80066a:	eb c3                	jmp    80062f <vprintfmt+0x1e1>
  80066c:	89 cf                	mov    %ecx,%edi
  80066e:	eb 0e                	jmp    80067e <vprintfmt+0x230>
				putch(' ', putdat);
  800670:	83 ec 08             	sub    $0x8,%esp
  800673:	53                   	push   %ebx
  800674:	6a 20                	push   $0x20
  800676:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800678:	83 ef 01             	sub    $0x1,%edi
  80067b:	83 c4 10             	add    $0x10,%esp
  80067e:	85 ff                	test   %edi,%edi
  800680:	7f ee                	jg     800670 <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  800682:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800685:	89 45 14             	mov    %eax,0x14(%ebp)
  800688:	e9 36 01 00 00       	jmp    8007c3 <vprintfmt+0x375>
  80068d:	89 cf                	mov    %ecx,%edi
  80068f:	eb ed                	jmp    80067e <vprintfmt+0x230>
	if (lflag >= 2)
  800691:	83 f9 01             	cmp    $0x1,%ecx
  800694:	7f 1f                	jg     8006b5 <vprintfmt+0x267>
	else if (lflag)
  800696:	85 c9                	test   %ecx,%ecx
  800698:	74 67                	je     800701 <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  80069a:	8b 45 14             	mov    0x14(%ebp),%eax
  80069d:	8b 00                	mov    (%eax),%eax
  80069f:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8006a2:	89 c1                	mov    %eax,%ecx
  8006a4:	c1 f9 1f             	sar    $0x1f,%ecx
  8006a7:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  8006aa:	8b 45 14             	mov    0x14(%ebp),%eax
  8006ad:	8d 40 04             	lea    0x4(%eax),%eax
  8006b0:	89 45 14             	mov    %eax,0x14(%ebp)
  8006b3:	eb 17                	jmp    8006cc <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  8006b5:	8b 45 14             	mov    0x14(%ebp),%eax
  8006b8:	8b 50 04             	mov    0x4(%eax),%edx
  8006bb:	8b 00                	mov    (%eax),%eax
  8006bd:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8006c0:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8006c3:	8b 45 14             	mov    0x14(%ebp),%eax
  8006c6:	8d 40 08             	lea    0x8(%eax),%eax
  8006c9:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  8006cc:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8006cf:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  8006d2:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  8006d7:	85 c9                	test   %ecx,%ecx
  8006d9:	0f 89 ca 00 00 00    	jns    8007a9 <vprintfmt+0x35b>
				putch('-', putdat);
  8006df:	83 ec 08             	sub    $0x8,%esp
  8006e2:	53                   	push   %ebx
  8006e3:	6a 2d                	push   $0x2d
  8006e5:	ff d6                	call   *%esi
				num = -(long long) num;
  8006e7:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8006ea:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  8006ed:	f7 da                	neg    %edx
  8006ef:	83 d1 00             	adc    $0x0,%ecx
  8006f2:	f7 d9                	neg    %ecx
  8006f4:	83 c4 10             	add    $0x10,%esp
			base = 10;
  8006f7:	b8 0a 00 00 00       	mov    $0xa,%eax
  8006fc:	e9 a8 00 00 00       	jmp    8007a9 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  800701:	8b 45 14             	mov    0x14(%ebp),%eax
  800704:	8b 00                	mov    (%eax),%eax
  800706:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800709:	99                   	cltd   
  80070a:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80070d:	8b 45 14             	mov    0x14(%ebp),%eax
  800710:	8d 40 04             	lea    0x4(%eax),%eax
  800713:	89 45 14             	mov    %eax,0x14(%ebp)
  800716:	eb b4                	jmp    8006cc <vprintfmt+0x27e>
	if (lflag >= 2)
  800718:	83 f9 01             	cmp    $0x1,%ecx
  80071b:	7f 1b                	jg     800738 <vprintfmt+0x2ea>
	else if (lflag)
  80071d:	85 c9                	test   %ecx,%ecx
  80071f:	74 2c                	je     80074d <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  800721:	8b 45 14             	mov    0x14(%ebp),%eax
  800724:	8b 10                	mov    (%eax),%edx
  800726:	b9 00 00 00 00       	mov    $0x0,%ecx
  80072b:	8d 40 04             	lea    0x4(%eax),%eax
  80072e:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800731:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  800736:	eb 71                	jmp    8007a9 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800738:	8b 45 14             	mov    0x14(%ebp),%eax
  80073b:	8b 10                	mov    (%eax),%edx
  80073d:	8b 48 04             	mov    0x4(%eax),%ecx
  800740:	8d 40 08             	lea    0x8(%eax),%eax
  800743:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800746:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  80074b:	eb 5c                	jmp    8007a9 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  80074d:	8b 45 14             	mov    0x14(%ebp),%eax
  800750:	8b 10                	mov    (%eax),%edx
  800752:	b9 00 00 00 00       	mov    $0x0,%ecx
  800757:	8d 40 04             	lea    0x4(%eax),%eax
  80075a:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80075d:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  800762:	eb 45                	jmp    8007a9 <vprintfmt+0x35b>
			putch('X', putdat);
  800764:	83 ec 08             	sub    $0x8,%esp
  800767:	53                   	push   %ebx
  800768:	6a 58                	push   $0x58
  80076a:	ff d6                	call   *%esi
			putch('X', putdat);
  80076c:	83 c4 08             	add    $0x8,%esp
  80076f:	53                   	push   %ebx
  800770:	6a 58                	push   $0x58
  800772:	ff d6                	call   *%esi
			putch('X', putdat);
  800774:	83 c4 08             	add    $0x8,%esp
  800777:	53                   	push   %ebx
  800778:	6a 58                	push   $0x58
  80077a:	ff d6                	call   *%esi
			break;
  80077c:	83 c4 10             	add    $0x10,%esp
  80077f:	eb 42                	jmp    8007c3 <vprintfmt+0x375>
			putch('0', putdat);
  800781:	83 ec 08             	sub    $0x8,%esp
  800784:	53                   	push   %ebx
  800785:	6a 30                	push   $0x30
  800787:	ff d6                	call   *%esi
			putch('x', putdat);
  800789:	83 c4 08             	add    $0x8,%esp
  80078c:	53                   	push   %ebx
  80078d:	6a 78                	push   $0x78
  80078f:	ff d6                	call   *%esi
			num = (unsigned long long)
  800791:	8b 45 14             	mov    0x14(%ebp),%eax
  800794:	8b 10                	mov    (%eax),%edx
  800796:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  80079b:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  80079e:	8d 40 04             	lea    0x4(%eax),%eax
  8007a1:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8007a4:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  8007a9:	83 ec 0c             	sub    $0xc,%esp
  8007ac:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  8007b0:	57                   	push   %edi
  8007b1:	ff 75 d4             	pushl  -0x2c(%ebp)
  8007b4:	50                   	push   %eax
  8007b5:	51                   	push   %ecx
  8007b6:	52                   	push   %edx
  8007b7:	89 da                	mov    %ebx,%edx
  8007b9:	89 f0                	mov    %esi,%eax
  8007bb:	e8 a3 fb ff ff       	call   800363 <printnum>
			break;
  8007c0:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  8007c3:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  8007c6:	83 c7 01             	add    $0x1,%edi
  8007c9:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8007cd:	83 f8 25             	cmp    $0x25,%eax
  8007d0:	0f 84 93 fc ff ff    	je     800469 <vprintfmt+0x1b>
			if (ch == '\0')
  8007d6:	85 c0                	test   %eax,%eax
  8007d8:	0f 84 8b 00 00 00    	je     800869 <vprintfmt+0x41b>
			putch(ch, putdat);
  8007de:	83 ec 08             	sub    $0x8,%esp
  8007e1:	53                   	push   %ebx
  8007e2:	50                   	push   %eax
  8007e3:	ff d6                	call   *%esi
  8007e5:	83 c4 10             	add    $0x10,%esp
  8007e8:	eb dc                	jmp    8007c6 <vprintfmt+0x378>
	if (lflag >= 2)
  8007ea:	83 f9 01             	cmp    $0x1,%ecx
  8007ed:	7f 1b                	jg     80080a <vprintfmt+0x3bc>
	else if (lflag)
  8007ef:	85 c9                	test   %ecx,%ecx
  8007f1:	74 2c                	je     80081f <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  8007f3:	8b 45 14             	mov    0x14(%ebp),%eax
  8007f6:	8b 10                	mov    (%eax),%edx
  8007f8:	b9 00 00 00 00       	mov    $0x0,%ecx
  8007fd:	8d 40 04             	lea    0x4(%eax),%eax
  800800:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800803:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  800808:	eb 9f                	jmp    8007a9 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  80080a:	8b 45 14             	mov    0x14(%ebp),%eax
  80080d:	8b 10                	mov    (%eax),%edx
  80080f:	8b 48 04             	mov    0x4(%eax),%ecx
  800812:	8d 40 08             	lea    0x8(%eax),%eax
  800815:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800818:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  80081d:	eb 8a                	jmp    8007a9 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  80081f:	8b 45 14             	mov    0x14(%ebp),%eax
  800822:	8b 10                	mov    (%eax),%edx
  800824:	b9 00 00 00 00       	mov    $0x0,%ecx
  800829:	8d 40 04             	lea    0x4(%eax),%eax
  80082c:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80082f:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  800834:	e9 70 ff ff ff       	jmp    8007a9 <vprintfmt+0x35b>
			putch(ch, putdat);
  800839:	83 ec 08             	sub    $0x8,%esp
  80083c:	53                   	push   %ebx
  80083d:	6a 25                	push   $0x25
  80083f:	ff d6                	call   *%esi
			break;
  800841:	83 c4 10             	add    $0x10,%esp
  800844:	e9 7a ff ff ff       	jmp    8007c3 <vprintfmt+0x375>
			putch('%', putdat);
  800849:	83 ec 08             	sub    $0x8,%esp
  80084c:	53                   	push   %ebx
  80084d:	6a 25                	push   $0x25
  80084f:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  800851:	83 c4 10             	add    $0x10,%esp
  800854:	89 f8                	mov    %edi,%eax
  800856:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  80085a:	74 05                	je     800861 <vprintfmt+0x413>
  80085c:	83 e8 01             	sub    $0x1,%eax
  80085f:	eb f5                	jmp    800856 <vprintfmt+0x408>
  800861:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800864:	e9 5a ff ff ff       	jmp    8007c3 <vprintfmt+0x375>
}
  800869:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80086c:	5b                   	pop    %ebx
  80086d:	5e                   	pop    %esi
  80086e:	5f                   	pop    %edi
  80086f:	5d                   	pop    %ebp
  800870:	c3                   	ret    

00800871 <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  800871:	f3 0f 1e fb          	endbr32 
  800875:	55                   	push   %ebp
  800876:	89 e5                	mov    %esp,%ebp
  800878:	83 ec 18             	sub    $0x18,%esp
  80087b:	8b 45 08             	mov    0x8(%ebp),%eax
  80087e:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  800881:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800884:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800888:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  80088b:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  800892:	85 c0                	test   %eax,%eax
  800894:	74 26                	je     8008bc <vsnprintf+0x4b>
  800896:	85 d2                	test   %edx,%edx
  800898:	7e 22                	jle    8008bc <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  80089a:	ff 75 14             	pushl  0x14(%ebp)
  80089d:	ff 75 10             	pushl  0x10(%ebp)
  8008a0:	8d 45 ec             	lea    -0x14(%ebp),%eax
  8008a3:	50                   	push   %eax
  8008a4:	68 0c 04 80 00       	push   $0x80040c
  8008a9:	e8 a0 fb ff ff       	call   80044e <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  8008ae:	8b 45 ec             	mov    -0x14(%ebp),%eax
  8008b1:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  8008b4:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8008b7:	83 c4 10             	add    $0x10,%esp
}
  8008ba:	c9                   	leave  
  8008bb:	c3                   	ret    
		return -E_INVAL;
  8008bc:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8008c1:	eb f7                	jmp    8008ba <vsnprintf+0x49>

008008c3 <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  8008c3:	f3 0f 1e fb          	endbr32 
  8008c7:	55                   	push   %ebp
  8008c8:	89 e5                	mov    %esp,%ebp
  8008ca:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  8008cd:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  8008d0:	50                   	push   %eax
  8008d1:	ff 75 10             	pushl  0x10(%ebp)
  8008d4:	ff 75 0c             	pushl  0xc(%ebp)
  8008d7:	ff 75 08             	pushl  0x8(%ebp)
  8008da:	e8 92 ff ff ff       	call   800871 <vsnprintf>
	va_end(ap);

	return rc;
}
  8008df:	c9                   	leave  
  8008e0:	c3                   	ret    

008008e1 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  8008e1:	f3 0f 1e fb          	endbr32 
  8008e5:	55                   	push   %ebp
  8008e6:	89 e5                	mov    %esp,%ebp
  8008e8:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  8008eb:	b8 00 00 00 00       	mov    $0x0,%eax
  8008f0:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  8008f4:	74 05                	je     8008fb <strlen+0x1a>
		n++;
  8008f6:	83 c0 01             	add    $0x1,%eax
  8008f9:	eb f5                	jmp    8008f0 <strlen+0xf>
	return n;
}
  8008fb:	5d                   	pop    %ebp
  8008fc:	c3                   	ret    

008008fd <strnlen>:

int
strnlen(const char *s, size_t size)
{
  8008fd:	f3 0f 1e fb          	endbr32 
  800901:	55                   	push   %ebp
  800902:	89 e5                	mov    %esp,%ebp
  800904:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800907:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  80090a:	b8 00 00 00 00       	mov    $0x0,%eax
  80090f:	39 d0                	cmp    %edx,%eax
  800911:	74 0d                	je     800920 <strnlen+0x23>
  800913:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  800917:	74 05                	je     80091e <strnlen+0x21>
		n++;
  800919:	83 c0 01             	add    $0x1,%eax
  80091c:	eb f1                	jmp    80090f <strnlen+0x12>
  80091e:	89 c2                	mov    %eax,%edx
	return n;
}
  800920:	89 d0                	mov    %edx,%eax
  800922:	5d                   	pop    %ebp
  800923:	c3                   	ret    

00800924 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800924:	f3 0f 1e fb          	endbr32 
  800928:	55                   	push   %ebp
  800929:	89 e5                	mov    %esp,%ebp
  80092b:	53                   	push   %ebx
  80092c:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80092f:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  800932:	b8 00 00 00 00       	mov    $0x0,%eax
  800937:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  80093b:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  80093e:	83 c0 01             	add    $0x1,%eax
  800941:	84 d2                	test   %dl,%dl
  800943:	75 f2                	jne    800937 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800945:	89 c8                	mov    %ecx,%eax
  800947:	5b                   	pop    %ebx
  800948:	5d                   	pop    %ebp
  800949:	c3                   	ret    

0080094a <strcat>:

char *
strcat(char *dst, const char *src)
{
  80094a:	f3 0f 1e fb          	endbr32 
  80094e:	55                   	push   %ebp
  80094f:	89 e5                	mov    %esp,%ebp
  800951:	53                   	push   %ebx
  800952:	83 ec 10             	sub    $0x10,%esp
  800955:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  800958:	53                   	push   %ebx
  800959:	e8 83 ff ff ff       	call   8008e1 <strlen>
  80095e:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  800961:	ff 75 0c             	pushl  0xc(%ebp)
  800964:	01 d8                	add    %ebx,%eax
  800966:	50                   	push   %eax
  800967:	e8 b8 ff ff ff       	call   800924 <strcpy>
	return dst;
}
  80096c:	89 d8                	mov    %ebx,%eax
  80096e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800971:	c9                   	leave  
  800972:	c3                   	ret    

00800973 <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  800973:	f3 0f 1e fb          	endbr32 
  800977:	55                   	push   %ebp
  800978:	89 e5                	mov    %esp,%ebp
  80097a:	56                   	push   %esi
  80097b:	53                   	push   %ebx
  80097c:	8b 75 08             	mov    0x8(%ebp),%esi
  80097f:	8b 55 0c             	mov    0xc(%ebp),%edx
  800982:	89 f3                	mov    %esi,%ebx
  800984:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800987:	89 f0                	mov    %esi,%eax
  800989:	39 d8                	cmp    %ebx,%eax
  80098b:	74 11                	je     80099e <strncpy+0x2b>
		*dst++ = *src;
  80098d:	83 c0 01             	add    $0x1,%eax
  800990:	0f b6 0a             	movzbl (%edx),%ecx
  800993:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800996:	80 f9 01             	cmp    $0x1,%cl
  800999:	83 da ff             	sbb    $0xffffffff,%edx
  80099c:	eb eb                	jmp    800989 <strncpy+0x16>
	}
	return ret;
}
  80099e:	89 f0                	mov    %esi,%eax
  8009a0:	5b                   	pop    %ebx
  8009a1:	5e                   	pop    %esi
  8009a2:	5d                   	pop    %ebp
  8009a3:	c3                   	ret    

008009a4 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  8009a4:	f3 0f 1e fb          	endbr32 
  8009a8:	55                   	push   %ebp
  8009a9:	89 e5                	mov    %esp,%ebp
  8009ab:	56                   	push   %esi
  8009ac:	53                   	push   %ebx
  8009ad:	8b 75 08             	mov    0x8(%ebp),%esi
  8009b0:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8009b3:	8b 55 10             	mov    0x10(%ebp),%edx
  8009b6:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  8009b8:	85 d2                	test   %edx,%edx
  8009ba:	74 21                	je     8009dd <strlcpy+0x39>
  8009bc:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  8009c0:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  8009c2:	39 c2                	cmp    %eax,%edx
  8009c4:	74 14                	je     8009da <strlcpy+0x36>
  8009c6:	0f b6 19             	movzbl (%ecx),%ebx
  8009c9:	84 db                	test   %bl,%bl
  8009cb:	74 0b                	je     8009d8 <strlcpy+0x34>
			*dst++ = *src++;
  8009cd:	83 c1 01             	add    $0x1,%ecx
  8009d0:	83 c2 01             	add    $0x1,%edx
  8009d3:	88 5a ff             	mov    %bl,-0x1(%edx)
  8009d6:	eb ea                	jmp    8009c2 <strlcpy+0x1e>
  8009d8:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  8009da:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  8009dd:	29 f0                	sub    %esi,%eax
}
  8009df:	5b                   	pop    %ebx
  8009e0:	5e                   	pop    %esi
  8009e1:	5d                   	pop    %ebp
  8009e2:	c3                   	ret    

008009e3 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  8009e3:	f3 0f 1e fb          	endbr32 
  8009e7:	55                   	push   %ebp
  8009e8:	89 e5                	mov    %esp,%ebp
  8009ea:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8009ed:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  8009f0:	0f b6 01             	movzbl (%ecx),%eax
  8009f3:	84 c0                	test   %al,%al
  8009f5:	74 0c                	je     800a03 <strcmp+0x20>
  8009f7:	3a 02                	cmp    (%edx),%al
  8009f9:	75 08                	jne    800a03 <strcmp+0x20>
		p++, q++;
  8009fb:	83 c1 01             	add    $0x1,%ecx
  8009fe:	83 c2 01             	add    $0x1,%edx
  800a01:	eb ed                	jmp    8009f0 <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  800a03:	0f b6 c0             	movzbl %al,%eax
  800a06:	0f b6 12             	movzbl (%edx),%edx
  800a09:	29 d0                	sub    %edx,%eax
}
  800a0b:	5d                   	pop    %ebp
  800a0c:	c3                   	ret    

00800a0d <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  800a0d:	f3 0f 1e fb          	endbr32 
  800a11:	55                   	push   %ebp
  800a12:	89 e5                	mov    %esp,%ebp
  800a14:	53                   	push   %ebx
  800a15:	8b 45 08             	mov    0x8(%ebp),%eax
  800a18:	8b 55 0c             	mov    0xc(%ebp),%edx
  800a1b:	89 c3                	mov    %eax,%ebx
  800a1d:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  800a20:	eb 06                	jmp    800a28 <strncmp+0x1b>
		n--, p++, q++;
  800a22:	83 c0 01             	add    $0x1,%eax
  800a25:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  800a28:	39 d8                	cmp    %ebx,%eax
  800a2a:	74 16                	je     800a42 <strncmp+0x35>
  800a2c:	0f b6 08             	movzbl (%eax),%ecx
  800a2f:	84 c9                	test   %cl,%cl
  800a31:	74 04                	je     800a37 <strncmp+0x2a>
  800a33:	3a 0a                	cmp    (%edx),%cl
  800a35:	74 eb                	je     800a22 <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800a37:	0f b6 00             	movzbl (%eax),%eax
  800a3a:	0f b6 12             	movzbl (%edx),%edx
  800a3d:	29 d0                	sub    %edx,%eax
}
  800a3f:	5b                   	pop    %ebx
  800a40:	5d                   	pop    %ebp
  800a41:	c3                   	ret    
		return 0;
  800a42:	b8 00 00 00 00       	mov    $0x0,%eax
  800a47:	eb f6                	jmp    800a3f <strncmp+0x32>

00800a49 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800a49:	f3 0f 1e fb          	endbr32 
  800a4d:	55                   	push   %ebp
  800a4e:	89 e5                	mov    %esp,%ebp
  800a50:	8b 45 08             	mov    0x8(%ebp),%eax
  800a53:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800a57:	0f b6 10             	movzbl (%eax),%edx
  800a5a:	84 d2                	test   %dl,%dl
  800a5c:	74 09                	je     800a67 <strchr+0x1e>
		if (*s == c)
  800a5e:	38 ca                	cmp    %cl,%dl
  800a60:	74 0a                	je     800a6c <strchr+0x23>
	for (; *s; s++)
  800a62:	83 c0 01             	add    $0x1,%eax
  800a65:	eb f0                	jmp    800a57 <strchr+0xe>
			return (char *) s;
	return 0;
  800a67:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a6c:	5d                   	pop    %ebp
  800a6d:	c3                   	ret    

00800a6e <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800a6e:	f3 0f 1e fb          	endbr32 
  800a72:	55                   	push   %ebp
  800a73:	89 e5                	mov    %esp,%ebp
  800a75:	8b 45 08             	mov    0x8(%ebp),%eax
  800a78:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800a7c:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  800a7f:	38 ca                	cmp    %cl,%dl
  800a81:	74 09                	je     800a8c <strfind+0x1e>
  800a83:	84 d2                	test   %dl,%dl
  800a85:	74 05                	je     800a8c <strfind+0x1e>
	for (; *s; s++)
  800a87:	83 c0 01             	add    $0x1,%eax
  800a8a:	eb f0                	jmp    800a7c <strfind+0xe>
			break;
	return (char *) s;
}
  800a8c:	5d                   	pop    %ebp
  800a8d:	c3                   	ret    

00800a8e <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800a8e:	f3 0f 1e fb          	endbr32 
  800a92:	55                   	push   %ebp
  800a93:	89 e5                	mov    %esp,%ebp
  800a95:	57                   	push   %edi
  800a96:	56                   	push   %esi
  800a97:	53                   	push   %ebx
  800a98:	8b 7d 08             	mov    0x8(%ebp),%edi
  800a9b:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800a9e:	85 c9                	test   %ecx,%ecx
  800aa0:	74 31                	je     800ad3 <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800aa2:	89 f8                	mov    %edi,%eax
  800aa4:	09 c8                	or     %ecx,%eax
  800aa6:	a8 03                	test   $0x3,%al
  800aa8:	75 23                	jne    800acd <memset+0x3f>
		c &= 0xFF;
  800aaa:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800aae:	89 d3                	mov    %edx,%ebx
  800ab0:	c1 e3 08             	shl    $0x8,%ebx
  800ab3:	89 d0                	mov    %edx,%eax
  800ab5:	c1 e0 18             	shl    $0x18,%eax
  800ab8:	89 d6                	mov    %edx,%esi
  800aba:	c1 e6 10             	shl    $0x10,%esi
  800abd:	09 f0                	or     %esi,%eax
  800abf:	09 c2                	or     %eax,%edx
  800ac1:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800ac3:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800ac6:	89 d0                	mov    %edx,%eax
  800ac8:	fc                   	cld    
  800ac9:	f3 ab                	rep stos %eax,%es:(%edi)
  800acb:	eb 06                	jmp    800ad3 <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800acd:	8b 45 0c             	mov    0xc(%ebp),%eax
  800ad0:	fc                   	cld    
  800ad1:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800ad3:	89 f8                	mov    %edi,%eax
  800ad5:	5b                   	pop    %ebx
  800ad6:	5e                   	pop    %esi
  800ad7:	5f                   	pop    %edi
  800ad8:	5d                   	pop    %ebp
  800ad9:	c3                   	ret    

00800ada <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800ada:	f3 0f 1e fb          	endbr32 
  800ade:	55                   	push   %ebp
  800adf:	89 e5                	mov    %esp,%ebp
  800ae1:	57                   	push   %edi
  800ae2:	56                   	push   %esi
  800ae3:	8b 45 08             	mov    0x8(%ebp),%eax
  800ae6:	8b 75 0c             	mov    0xc(%ebp),%esi
  800ae9:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800aec:	39 c6                	cmp    %eax,%esi
  800aee:	73 32                	jae    800b22 <memmove+0x48>
  800af0:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  800af3:	39 c2                	cmp    %eax,%edx
  800af5:	76 2b                	jbe    800b22 <memmove+0x48>
		s += n;
		d += n;
  800af7:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800afa:	89 fe                	mov    %edi,%esi
  800afc:	09 ce                	or     %ecx,%esi
  800afe:	09 d6                	or     %edx,%esi
  800b00:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800b06:	75 0e                	jne    800b16 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800b08:	83 ef 04             	sub    $0x4,%edi
  800b0b:	8d 72 fc             	lea    -0x4(%edx),%esi
  800b0e:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800b11:	fd                   	std    
  800b12:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800b14:	eb 09                	jmp    800b1f <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800b16:	83 ef 01             	sub    $0x1,%edi
  800b19:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800b1c:	fd                   	std    
  800b1d:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800b1f:	fc                   	cld    
  800b20:	eb 1a                	jmp    800b3c <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800b22:	89 c2                	mov    %eax,%edx
  800b24:	09 ca                	or     %ecx,%edx
  800b26:	09 f2                	or     %esi,%edx
  800b28:	f6 c2 03             	test   $0x3,%dl
  800b2b:	75 0a                	jne    800b37 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800b2d:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800b30:	89 c7                	mov    %eax,%edi
  800b32:	fc                   	cld    
  800b33:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800b35:	eb 05                	jmp    800b3c <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800b37:	89 c7                	mov    %eax,%edi
  800b39:	fc                   	cld    
  800b3a:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800b3c:	5e                   	pop    %esi
  800b3d:	5f                   	pop    %edi
  800b3e:	5d                   	pop    %ebp
  800b3f:	c3                   	ret    

00800b40 <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800b40:	f3 0f 1e fb          	endbr32 
  800b44:	55                   	push   %ebp
  800b45:	89 e5                	mov    %esp,%ebp
  800b47:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800b4a:	ff 75 10             	pushl  0x10(%ebp)
  800b4d:	ff 75 0c             	pushl  0xc(%ebp)
  800b50:	ff 75 08             	pushl  0x8(%ebp)
  800b53:	e8 82 ff ff ff       	call   800ada <memmove>
}
  800b58:	c9                   	leave  
  800b59:	c3                   	ret    

00800b5a <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800b5a:	f3 0f 1e fb          	endbr32 
  800b5e:	55                   	push   %ebp
  800b5f:	89 e5                	mov    %esp,%ebp
  800b61:	56                   	push   %esi
  800b62:	53                   	push   %ebx
  800b63:	8b 45 08             	mov    0x8(%ebp),%eax
  800b66:	8b 55 0c             	mov    0xc(%ebp),%edx
  800b69:	89 c6                	mov    %eax,%esi
  800b6b:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800b6e:	39 f0                	cmp    %esi,%eax
  800b70:	74 1c                	je     800b8e <memcmp+0x34>
		if (*s1 != *s2)
  800b72:	0f b6 08             	movzbl (%eax),%ecx
  800b75:	0f b6 1a             	movzbl (%edx),%ebx
  800b78:	38 d9                	cmp    %bl,%cl
  800b7a:	75 08                	jne    800b84 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800b7c:	83 c0 01             	add    $0x1,%eax
  800b7f:	83 c2 01             	add    $0x1,%edx
  800b82:	eb ea                	jmp    800b6e <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800b84:	0f b6 c1             	movzbl %cl,%eax
  800b87:	0f b6 db             	movzbl %bl,%ebx
  800b8a:	29 d8                	sub    %ebx,%eax
  800b8c:	eb 05                	jmp    800b93 <memcmp+0x39>
	}

	return 0;
  800b8e:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800b93:	5b                   	pop    %ebx
  800b94:	5e                   	pop    %esi
  800b95:	5d                   	pop    %ebp
  800b96:	c3                   	ret    

00800b97 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800b97:	f3 0f 1e fb          	endbr32 
  800b9b:	55                   	push   %ebp
  800b9c:	89 e5                	mov    %esp,%ebp
  800b9e:	8b 45 08             	mov    0x8(%ebp),%eax
  800ba1:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800ba4:	89 c2                	mov    %eax,%edx
  800ba6:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800ba9:	39 d0                	cmp    %edx,%eax
  800bab:	73 09                	jae    800bb6 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800bad:	38 08                	cmp    %cl,(%eax)
  800baf:	74 05                	je     800bb6 <memfind+0x1f>
	for (; s < ends; s++)
  800bb1:	83 c0 01             	add    $0x1,%eax
  800bb4:	eb f3                	jmp    800ba9 <memfind+0x12>
			break;
	return (void *) s;
}
  800bb6:	5d                   	pop    %ebp
  800bb7:	c3                   	ret    

00800bb8 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800bb8:	f3 0f 1e fb          	endbr32 
  800bbc:	55                   	push   %ebp
  800bbd:	89 e5                	mov    %esp,%ebp
  800bbf:	57                   	push   %edi
  800bc0:	56                   	push   %esi
  800bc1:	53                   	push   %ebx
  800bc2:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800bc5:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800bc8:	eb 03                	jmp    800bcd <strtol+0x15>
		s++;
  800bca:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800bcd:	0f b6 01             	movzbl (%ecx),%eax
  800bd0:	3c 20                	cmp    $0x20,%al
  800bd2:	74 f6                	je     800bca <strtol+0x12>
  800bd4:	3c 09                	cmp    $0x9,%al
  800bd6:	74 f2                	je     800bca <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800bd8:	3c 2b                	cmp    $0x2b,%al
  800bda:	74 2a                	je     800c06 <strtol+0x4e>
	int neg = 0;
  800bdc:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800be1:	3c 2d                	cmp    $0x2d,%al
  800be3:	74 2b                	je     800c10 <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800be5:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800beb:	75 0f                	jne    800bfc <strtol+0x44>
  800bed:	80 39 30             	cmpb   $0x30,(%ecx)
  800bf0:	74 28                	je     800c1a <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800bf2:	85 db                	test   %ebx,%ebx
  800bf4:	b8 0a 00 00 00       	mov    $0xa,%eax
  800bf9:	0f 44 d8             	cmove  %eax,%ebx
  800bfc:	b8 00 00 00 00       	mov    $0x0,%eax
  800c01:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800c04:	eb 46                	jmp    800c4c <strtol+0x94>
		s++;
  800c06:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800c09:	bf 00 00 00 00       	mov    $0x0,%edi
  800c0e:	eb d5                	jmp    800be5 <strtol+0x2d>
		s++, neg = 1;
  800c10:	83 c1 01             	add    $0x1,%ecx
  800c13:	bf 01 00 00 00       	mov    $0x1,%edi
  800c18:	eb cb                	jmp    800be5 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800c1a:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800c1e:	74 0e                	je     800c2e <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800c20:	85 db                	test   %ebx,%ebx
  800c22:	75 d8                	jne    800bfc <strtol+0x44>
		s++, base = 8;
  800c24:	83 c1 01             	add    $0x1,%ecx
  800c27:	bb 08 00 00 00       	mov    $0x8,%ebx
  800c2c:	eb ce                	jmp    800bfc <strtol+0x44>
		s += 2, base = 16;
  800c2e:	83 c1 02             	add    $0x2,%ecx
  800c31:	bb 10 00 00 00       	mov    $0x10,%ebx
  800c36:	eb c4                	jmp    800bfc <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800c38:	0f be d2             	movsbl %dl,%edx
  800c3b:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800c3e:	3b 55 10             	cmp    0x10(%ebp),%edx
  800c41:	7d 3a                	jge    800c7d <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800c43:	83 c1 01             	add    $0x1,%ecx
  800c46:	0f af 45 10          	imul   0x10(%ebp),%eax
  800c4a:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800c4c:	0f b6 11             	movzbl (%ecx),%edx
  800c4f:	8d 72 d0             	lea    -0x30(%edx),%esi
  800c52:	89 f3                	mov    %esi,%ebx
  800c54:	80 fb 09             	cmp    $0x9,%bl
  800c57:	76 df                	jbe    800c38 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800c59:	8d 72 9f             	lea    -0x61(%edx),%esi
  800c5c:	89 f3                	mov    %esi,%ebx
  800c5e:	80 fb 19             	cmp    $0x19,%bl
  800c61:	77 08                	ja     800c6b <strtol+0xb3>
			dig = *s - 'a' + 10;
  800c63:	0f be d2             	movsbl %dl,%edx
  800c66:	83 ea 57             	sub    $0x57,%edx
  800c69:	eb d3                	jmp    800c3e <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800c6b:	8d 72 bf             	lea    -0x41(%edx),%esi
  800c6e:	89 f3                	mov    %esi,%ebx
  800c70:	80 fb 19             	cmp    $0x19,%bl
  800c73:	77 08                	ja     800c7d <strtol+0xc5>
			dig = *s - 'A' + 10;
  800c75:	0f be d2             	movsbl %dl,%edx
  800c78:	83 ea 37             	sub    $0x37,%edx
  800c7b:	eb c1                	jmp    800c3e <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800c7d:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800c81:	74 05                	je     800c88 <strtol+0xd0>
		*endptr = (char *) s;
  800c83:	8b 75 0c             	mov    0xc(%ebp),%esi
  800c86:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800c88:	89 c2                	mov    %eax,%edx
  800c8a:	f7 da                	neg    %edx
  800c8c:	85 ff                	test   %edi,%edi
  800c8e:	0f 45 c2             	cmovne %edx,%eax
}
  800c91:	5b                   	pop    %ebx
  800c92:	5e                   	pop    %esi
  800c93:	5f                   	pop    %edi
  800c94:	5d                   	pop    %ebp
  800c95:	c3                   	ret    

00800c96 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800c96:	f3 0f 1e fb          	endbr32 
  800c9a:	55                   	push   %ebp
  800c9b:	89 e5                	mov    %esp,%ebp
  800c9d:	57                   	push   %edi
  800c9e:	56                   	push   %esi
  800c9f:	53                   	push   %ebx
	asm volatile("int %1\n"
  800ca0:	b8 00 00 00 00       	mov    $0x0,%eax
  800ca5:	8b 55 08             	mov    0x8(%ebp),%edx
  800ca8:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800cab:	89 c3                	mov    %eax,%ebx
  800cad:	89 c7                	mov    %eax,%edi
  800caf:	89 c6                	mov    %eax,%esi
  800cb1:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800cb3:	5b                   	pop    %ebx
  800cb4:	5e                   	pop    %esi
  800cb5:	5f                   	pop    %edi
  800cb6:	5d                   	pop    %ebp
  800cb7:	c3                   	ret    

00800cb8 <sys_cgetc>:

int
sys_cgetc(void)
{
  800cb8:	f3 0f 1e fb          	endbr32 
  800cbc:	55                   	push   %ebp
  800cbd:	89 e5                	mov    %esp,%ebp
  800cbf:	57                   	push   %edi
  800cc0:	56                   	push   %esi
  800cc1:	53                   	push   %ebx
	asm volatile("int %1\n"
  800cc2:	ba 00 00 00 00       	mov    $0x0,%edx
  800cc7:	b8 01 00 00 00       	mov    $0x1,%eax
  800ccc:	89 d1                	mov    %edx,%ecx
  800cce:	89 d3                	mov    %edx,%ebx
  800cd0:	89 d7                	mov    %edx,%edi
  800cd2:	89 d6                	mov    %edx,%esi
  800cd4:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800cd6:	5b                   	pop    %ebx
  800cd7:	5e                   	pop    %esi
  800cd8:	5f                   	pop    %edi
  800cd9:	5d                   	pop    %ebp
  800cda:	c3                   	ret    

00800cdb <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800cdb:	f3 0f 1e fb          	endbr32 
  800cdf:	55                   	push   %ebp
  800ce0:	89 e5                	mov    %esp,%ebp
  800ce2:	57                   	push   %edi
  800ce3:	56                   	push   %esi
  800ce4:	53                   	push   %ebx
  800ce5:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800ce8:	b9 00 00 00 00       	mov    $0x0,%ecx
  800ced:	8b 55 08             	mov    0x8(%ebp),%edx
  800cf0:	b8 03 00 00 00       	mov    $0x3,%eax
  800cf5:	89 cb                	mov    %ecx,%ebx
  800cf7:	89 cf                	mov    %ecx,%edi
  800cf9:	89 ce                	mov    %ecx,%esi
  800cfb:	cd 30                	int    $0x30
	if(check && ret > 0)
  800cfd:	85 c0                	test   %eax,%eax
  800cff:	7f 08                	jg     800d09 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800d01:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d04:	5b                   	pop    %ebx
  800d05:	5e                   	pop    %esi
  800d06:	5f                   	pop    %edi
  800d07:	5d                   	pop    %ebp
  800d08:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d09:	83 ec 0c             	sub    $0xc,%esp
  800d0c:	50                   	push   %eax
  800d0d:	6a 03                	push   $0x3
  800d0f:	68 7f 28 80 00       	push   $0x80287f
  800d14:	6a 23                	push   $0x23
  800d16:	68 9c 28 80 00       	push   $0x80289c
  800d1b:	e8 44 f5 ff ff       	call   800264 <_panic>

00800d20 <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800d20:	f3 0f 1e fb          	endbr32 
  800d24:	55                   	push   %ebp
  800d25:	89 e5                	mov    %esp,%ebp
  800d27:	57                   	push   %edi
  800d28:	56                   	push   %esi
  800d29:	53                   	push   %ebx
	asm volatile("int %1\n"
  800d2a:	ba 00 00 00 00       	mov    $0x0,%edx
  800d2f:	b8 02 00 00 00       	mov    $0x2,%eax
  800d34:	89 d1                	mov    %edx,%ecx
  800d36:	89 d3                	mov    %edx,%ebx
  800d38:	89 d7                	mov    %edx,%edi
  800d3a:	89 d6                	mov    %edx,%esi
  800d3c:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800d3e:	5b                   	pop    %ebx
  800d3f:	5e                   	pop    %esi
  800d40:	5f                   	pop    %edi
  800d41:	5d                   	pop    %ebp
  800d42:	c3                   	ret    

00800d43 <sys_yield>:

void
sys_yield(void)
{
  800d43:	f3 0f 1e fb          	endbr32 
  800d47:	55                   	push   %ebp
  800d48:	89 e5                	mov    %esp,%ebp
  800d4a:	57                   	push   %edi
  800d4b:	56                   	push   %esi
  800d4c:	53                   	push   %ebx
	asm volatile("int %1\n"
  800d4d:	ba 00 00 00 00       	mov    $0x0,%edx
  800d52:	b8 0b 00 00 00       	mov    $0xb,%eax
  800d57:	89 d1                	mov    %edx,%ecx
  800d59:	89 d3                	mov    %edx,%ebx
  800d5b:	89 d7                	mov    %edx,%edi
  800d5d:	89 d6                	mov    %edx,%esi
  800d5f:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800d61:	5b                   	pop    %ebx
  800d62:	5e                   	pop    %esi
  800d63:	5f                   	pop    %edi
  800d64:	5d                   	pop    %ebp
  800d65:	c3                   	ret    

00800d66 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800d66:	f3 0f 1e fb          	endbr32 
  800d6a:	55                   	push   %ebp
  800d6b:	89 e5                	mov    %esp,%ebp
  800d6d:	57                   	push   %edi
  800d6e:	56                   	push   %esi
  800d6f:	53                   	push   %ebx
  800d70:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d73:	be 00 00 00 00       	mov    $0x0,%esi
  800d78:	8b 55 08             	mov    0x8(%ebp),%edx
  800d7b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d7e:	b8 04 00 00 00       	mov    $0x4,%eax
  800d83:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800d86:	89 f7                	mov    %esi,%edi
  800d88:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d8a:	85 c0                	test   %eax,%eax
  800d8c:	7f 08                	jg     800d96 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800d8e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d91:	5b                   	pop    %ebx
  800d92:	5e                   	pop    %esi
  800d93:	5f                   	pop    %edi
  800d94:	5d                   	pop    %ebp
  800d95:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d96:	83 ec 0c             	sub    $0xc,%esp
  800d99:	50                   	push   %eax
  800d9a:	6a 04                	push   $0x4
  800d9c:	68 7f 28 80 00       	push   $0x80287f
  800da1:	6a 23                	push   $0x23
  800da3:	68 9c 28 80 00       	push   $0x80289c
  800da8:	e8 b7 f4 ff ff       	call   800264 <_panic>

00800dad <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800dad:	f3 0f 1e fb          	endbr32 
  800db1:	55                   	push   %ebp
  800db2:	89 e5                	mov    %esp,%ebp
  800db4:	57                   	push   %edi
  800db5:	56                   	push   %esi
  800db6:	53                   	push   %ebx
  800db7:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800dba:	8b 55 08             	mov    0x8(%ebp),%edx
  800dbd:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800dc0:	b8 05 00 00 00       	mov    $0x5,%eax
  800dc5:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800dc8:	8b 7d 14             	mov    0x14(%ebp),%edi
  800dcb:	8b 75 18             	mov    0x18(%ebp),%esi
  800dce:	cd 30                	int    $0x30
	if(check && ret > 0)
  800dd0:	85 c0                	test   %eax,%eax
  800dd2:	7f 08                	jg     800ddc <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800dd4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800dd7:	5b                   	pop    %ebx
  800dd8:	5e                   	pop    %esi
  800dd9:	5f                   	pop    %edi
  800dda:	5d                   	pop    %ebp
  800ddb:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ddc:	83 ec 0c             	sub    $0xc,%esp
  800ddf:	50                   	push   %eax
  800de0:	6a 05                	push   $0x5
  800de2:	68 7f 28 80 00       	push   $0x80287f
  800de7:	6a 23                	push   $0x23
  800de9:	68 9c 28 80 00       	push   $0x80289c
  800dee:	e8 71 f4 ff ff       	call   800264 <_panic>

00800df3 <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800df3:	f3 0f 1e fb          	endbr32 
  800df7:	55                   	push   %ebp
  800df8:	89 e5                	mov    %esp,%ebp
  800dfa:	57                   	push   %edi
  800dfb:	56                   	push   %esi
  800dfc:	53                   	push   %ebx
  800dfd:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e00:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e05:	8b 55 08             	mov    0x8(%ebp),%edx
  800e08:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e0b:	b8 06 00 00 00       	mov    $0x6,%eax
  800e10:	89 df                	mov    %ebx,%edi
  800e12:	89 de                	mov    %ebx,%esi
  800e14:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e16:	85 c0                	test   %eax,%eax
  800e18:	7f 08                	jg     800e22 <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800e1a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e1d:	5b                   	pop    %ebx
  800e1e:	5e                   	pop    %esi
  800e1f:	5f                   	pop    %edi
  800e20:	5d                   	pop    %ebp
  800e21:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e22:	83 ec 0c             	sub    $0xc,%esp
  800e25:	50                   	push   %eax
  800e26:	6a 06                	push   $0x6
  800e28:	68 7f 28 80 00       	push   $0x80287f
  800e2d:	6a 23                	push   $0x23
  800e2f:	68 9c 28 80 00       	push   $0x80289c
  800e34:	e8 2b f4 ff ff       	call   800264 <_panic>

00800e39 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800e39:	f3 0f 1e fb          	endbr32 
  800e3d:	55                   	push   %ebp
  800e3e:	89 e5                	mov    %esp,%ebp
  800e40:	57                   	push   %edi
  800e41:	56                   	push   %esi
  800e42:	53                   	push   %ebx
  800e43:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e46:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e4b:	8b 55 08             	mov    0x8(%ebp),%edx
  800e4e:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e51:	b8 08 00 00 00       	mov    $0x8,%eax
  800e56:	89 df                	mov    %ebx,%edi
  800e58:	89 de                	mov    %ebx,%esi
  800e5a:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e5c:	85 c0                	test   %eax,%eax
  800e5e:	7f 08                	jg     800e68 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800e60:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e63:	5b                   	pop    %ebx
  800e64:	5e                   	pop    %esi
  800e65:	5f                   	pop    %edi
  800e66:	5d                   	pop    %ebp
  800e67:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e68:	83 ec 0c             	sub    $0xc,%esp
  800e6b:	50                   	push   %eax
  800e6c:	6a 08                	push   $0x8
  800e6e:	68 7f 28 80 00       	push   $0x80287f
  800e73:	6a 23                	push   $0x23
  800e75:	68 9c 28 80 00       	push   $0x80289c
  800e7a:	e8 e5 f3 ff ff       	call   800264 <_panic>

00800e7f <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800e7f:	f3 0f 1e fb          	endbr32 
  800e83:	55                   	push   %ebp
  800e84:	89 e5                	mov    %esp,%ebp
  800e86:	57                   	push   %edi
  800e87:	56                   	push   %esi
  800e88:	53                   	push   %ebx
  800e89:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e8c:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e91:	8b 55 08             	mov    0x8(%ebp),%edx
  800e94:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e97:	b8 09 00 00 00       	mov    $0x9,%eax
  800e9c:	89 df                	mov    %ebx,%edi
  800e9e:	89 de                	mov    %ebx,%esi
  800ea0:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ea2:	85 c0                	test   %eax,%eax
  800ea4:	7f 08                	jg     800eae <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800ea6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ea9:	5b                   	pop    %ebx
  800eaa:	5e                   	pop    %esi
  800eab:	5f                   	pop    %edi
  800eac:	5d                   	pop    %ebp
  800ead:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800eae:	83 ec 0c             	sub    $0xc,%esp
  800eb1:	50                   	push   %eax
  800eb2:	6a 09                	push   $0x9
  800eb4:	68 7f 28 80 00       	push   $0x80287f
  800eb9:	6a 23                	push   $0x23
  800ebb:	68 9c 28 80 00       	push   $0x80289c
  800ec0:	e8 9f f3 ff ff       	call   800264 <_panic>

00800ec5 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800ec5:	f3 0f 1e fb          	endbr32 
  800ec9:	55                   	push   %ebp
  800eca:	89 e5                	mov    %esp,%ebp
  800ecc:	57                   	push   %edi
  800ecd:	56                   	push   %esi
  800ece:	53                   	push   %ebx
  800ecf:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800ed2:	bb 00 00 00 00       	mov    $0x0,%ebx
  800ed7:	8b 55 08             	mov    0x8(%ebp),%edx
  800eda:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800edd:	b8 0a 00 00 00       	mov    $0xa,%eax
  800ee2:	89 df                	mov    %ebx,%edi
  800ee4:	89 de                	mov    %ebx,%esi
  800ee6:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ee8:	85 c0                	test   %eax,%eax
  800eea:	7f 08                	jg     800ef4 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800eec:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800eef:	5b                   	pop    %ebx
  800ef0:	5e                   	pop    %esi
  800ef1:	5f                   	pop    %edi
  800ef2:	5d                   	pop    %ebp
  800ef3:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ef4:	83 ec 0c             	sub    $0xc,%esp
  800ef7:	50                   	push   %eax
  800ef8:	6a 0a                	push   $0xa
  800efa:	68 7f 28 80 00       	push   $0x80287f
  800eff:	6a 23                	push   $0x23
  800f01:	68 9c 28 80 00       	push   $0x80289c
  800f06:	e8 59 f3 ff ff       	call   800264 <_panic>

00800f0b <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800f0b:	f3 0f 1e fb          	endbr32 
  800f0f:	55                   	push   %ebp
  800f10:	89 e5                	mov    %esp,%ebp
  800f12:	57                   	push   %edi
  800f13:	56                   	push   %esi
  800f14:	53                   	push   %ebx
	asm volatile("int %1\n"
  800f15:	8b 55 08             	mov    0x8(%ebp),%edx
  800f18:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800f1b:	b8 0c 00 00 00       	mov    $0xc,%eax
  800f20:	be 00 00 00 00       	mov    $0x0,%esi
  800f25:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800f28:	8b 7d 14             	mov    0x14(%ebp),%edi
  800f2b:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800f2d:	5b                   	pop    %ebx
  800f2e:	5e                   	pop    %esi
  800f2f:	5f                   	pop    %edi
  800f30:	5d                   	pop    %ebp
  800f31:	c3                   	ret    

00800f32 <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800f32:	f3 0f 1e fb          	endbr32 
  800f36:	55                   	push   %ebp
  800f37:	89 e5                	mov    %esp,%ebp
  800f39:	57                   	push   %edi
  800f3a:	56                   	push   %esi
  800f3b:	53                   	push   %ebx
  800f3c:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800f3f:	b9 00 00 00 00       	mov    $0x0,%ecx
  800f44:	8b 55 08             	mov    0x8(%ebp),%edx
  800f47:	b8 0d 00 00 00       	mov    $0xd,%eax
  800f4c:	89 cb                	mov    %ecx,%ebx
  800f4e:	89 cf                	mov    %ecx,%edi
  800f50:	89 ce                	mov    %ecx,%esi
  800f52:	cd 30                	int    $0x30
	if(check && ret > 0)
  800f54:	85 c0                	test   %eax,%eax
  800f56:	7f 08                	jg     800f60 <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800f58:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800f5b:	5b                   	pop    %ebx
  800f5c:	5e                   	pop    %esi
  800f5d:	5f                   	pop    %edi
  800f5e:	5d                   	pop    %ebp
  800f5f:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800f60:	83 ec 0c             	sub    $0xc,%esp
  800f63:	50                   	push   %eax
  800f64:	6a 0d                	push   $0xd
  800f66:	68 7f 28 80 00       	push   $0x80287f
  800f6b:	6a 23                	push   $0x23
  800f6d:	68 9c 28 80 00       	push   $0x80289c
  800f72:	e8 ed f2 ff ff       	call   800264 <_panic>

00800f77 <pgfault>:
// Custom page fault handler - if faulting page is copy-on-write,
// map in our own private writable copy.
//
static void
pgfault(struct UTrapframe *utf)
{
  800f77:	f3 0f 1e fb          	endbr32 
  800f7b:	55                   	push   %ebp
  800f7c:	89 e5                	mov    %esp,%ebp
  800f7e:	56                   	push   %esi
  800f7f:	53                   	push   %ebx
  800f80:	8b 45 08             	mov    0x8(%ebp),%eax
	void *addr = (void *) utf->utf_fault_va;
  800f83:	8b 18                	mov    (%eax),%ebx
	/*
	将父进程空间中所有可以写的页表的部分全部标记为可读且COW【因此读取的时候不会进入pgfault，但是写的时候会触发pgfault】。
	而当父进程或者子进程任意一个发生了写的时候，因为页表现在都是不可写的，所以会触发异常，进入到我们设定的page fault处理例程，
	当检测到是对COW页的写操作的情况下，就可以将要写入的页的内容全部拷贝一份，重新映射。
	*/
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800f85:	f6 40 04 02          	testb  $0x2,0x4(%eax)
  800f89:	0f 84 b2 00 00 00    	je     801041 <pgfault+0xca>
  800f8f:	89 d8                	mov    %ebx,%eax
  800f91:	c1 e8 16             	shr    $0x16,%eax
  800f94:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800f9b:	a8 01                	test   $0x1,%al
  800f9d:	0f 84 9e 00 00 00    	je     801041 <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800fa3:	89 d8                	mov    %ebx,%eax
  800fa5:	c1 e8 0c             	shr    $0xc,%eax
  800fa8:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800faf:	f6 c2 01             	test   $0x1,%dl
  800fb2:	0f 84 89 00 00 00    	je     801041 <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800fb8:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800fbf:	f6 c4 08             	test   $0x8,%ah
  800fc2:	74 7d                	je     801041 <pgfault+0xca>
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
	//为该进程分配新的页面。
	envid_t envid=sys_getenvid();
  800fc4:	e8 57 fd ff ff       	call   800d20 <sys_getenvid>
  800fc9:	89 c6                	mov    %eax,%esi
	r=sys_page_alloc(envid,(void*)PFTEMP,PTE_P|PTE_U|PTE_W);
  800fcb:	83 ec 04             	sub    $0x4,%esp
  800fce:	6a 07                	push   $0x7
  800fd0:	68 00 f0 7f 00       	push   $0x7ff000
  800fd5:	50                   	push   %eax
  800fd6:	e8 8b fd ff ff       	call   800d66 <sys_page_alloc>
	if(r<0){
  800fdb:	83 c4 10             	add    $0x10,%esp
  800fde:	85 c0                	test   %eax,%eax
  800fe0:	78 73                	js     801055 <pgfault+0xde>
		 panic("pgfault: page allocation failed %e", r);
	}
	//解开了我的疑惑，为什么随着fork页空间会逐渐发生偏移。
	//迁移数据过去。
	addr=ROUNDDOWN(addr,PGSIZE);
  800fe2:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	//拷贝内容。
	memmove(PFTEMP,addr,PGSIZE);
  800fe8:	83 ec 04             	sub    $0x4,%esp
  800feb:	68 00 10 00 00       	push   $0x1000
  800ff0:	53                   	push   %ebx
  800ff1:	68 00 f0 7f 00       	push   $0x7ff000
  800ff6:	e8 df fa ff ff       	call   800ada <memmove>
	//解除和addr的映射关系。
	r=sys_page_unmap(envid,(void*)addr);
  800ffb:	83 c4 08             	add    $0x8,%esp
  800ffe:	53                   	push   %ebx
  800fff:	56                   	push   %esi
  801000:	e8 ee fd ff ff       	call   800df3 <sys_page_unmap>
	if(r<0)
  801005:	83 c4 10             	add    $0x10,%esp
  801008:	85 c0                	test   %eax,%eax
  80100a:	78 5b                	js     801067 <pgfault+0xf0>
	panic("pgfault: page unmap failed %e", r);
	r=sys_page_map(envid,PFTEMP,envid,addr,PTE_P|PTE_U|PTE_W);
  80100c:	83 ec 0c             	sub    $0xc,%esp
  80100f:	6a 07                	push   $0x7
  801011:	53                   	push   %ebx
  801012:	56                   	push   %esi
  801013:	68 00 f0 7f 00       	push   $0x7ff000
  801018:	56                   	push   %esi
  801019:	e8 8f fd ff ff       	call   800dad <sys_page_map>
	if(r<0)
  80101e:	83 c4 20             	add    $0x20,%esp
  801021:	85 c0                	test   %eax,%eax
  801023:	78 54                	js     801079 <pgfault+0x102>
	panic("pgfault: page map failed %e", r);
	r=sys_page_unmap(envid,PFTEMP);
  801025:	83 ec 08             	sub    $0x8,%esp
  801028:	68 00 f0 7f 00       	push   $0x7ff000
  80102d:	56                   	push   %esi
  80102e:	e8 c0 fd ff ff       	call   800df3 <sys_page_unmap>
	if(r<0)
  801033:	83 c4 10             	add    $0x10,%esp
  801036:	85 c0                	test   %eax,%eax
  801038:	78 51                	js     80108b <pgfault+0x114>
	panic("pgfault: page unmap failed %e", r);
}
  80103a:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80103d:	5b                   	pop    %ebx
  80103e:	5e                   	pop    %esi
  80103f:	5d                   	pop    %ebp
  801040:	c3                   	ret    
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
  801041:	83 ec 04             	sub    $0x4,%esp
  801044:	68 ac 28 80 00       	push   $0x8028ac
  801049:	6a 2c                	push   $0x2c
  80104b:	68 5b 29 80 00       	push   $0x80295b
  801050:	e8 0f f2 ff ff       	call   800264 <_panic>
		 panic("pgfault: page allocation failed %e", r);
  801055:	50                   	push   %eax
  801056:	68 ec 28 80 00       	push   $0x8028ec
  80105b:	6a 31                	push   $0x31
  80105d:	68 5b 29 80 00       	push   $0x80295b
  801062:	e8 fd f1 ff ff       	call   800264 <_panic>
	panic("pgfault: page unmap failed %e", r);
  801067:	50                   	push   %eax
  801068:	68 66 29 80 00       	push   $0x802966
  80106d:	6a 3b                	push   $0x3b
  80106f:	68 5b 29 80 00       	push   $0x80295b
  801074:	e8 eb f1 ff ff       	call   800264 <_panic>
	panic("pgfault: page map failed %e", r);
  801079:	50                   	push   %eax
  80107a:	68 84 29 80 00       	push   $0x802984
  80107f:	6a 3e                	push   $0x3e
  801081:	68 5b 29 80 00       	push   $0x80295b
  801086:	e8 d9 f1 ff ff       	call   800264 <_panic>
	panic("pgfault: page unmap failed %e", r);
  80108b:	50                   	push   %eax
  80108c:	68 66 29 80 00       	push   $0x802966
  801091:	6a 41                	push   $0x41
  801093:	68 5b 29 80 00       	push   $0x80295b
  801098:	e8 c7 f1 ff ff       	call   800264 <_panic>

0080109d <fork>:
//   Neither user exception stack should ever be marked copy-on-write,
//   so you must allocate a new page for the child's user exception stack.
//
envid_t
fork(void)
{
  80109d:	f3 0f 1e fb          	endbr32 
  8010a1:	55                   	push   %ebp
  8010a2:	89 e5                	mov    %esp,%ebp
  8010a4:	57                   	push   %edi
  8010a5:	56                   	push   %esi
  8010a6:	53                   	push   %ebx
  8010a7:	83 ec 28             	sub    $0x28,%esp
	// LAB 4: Your code here.
	envid_t envid;
	uintptr_t pageVa;
	unsigned pn;
	//设置pgfault情况下对应处理的函数。
	set_pgfault_handler(pgfault);
  8010aa:	68 77 0f 80 00       	push   $0x800f77
  8010af:	e8 9f 10 00 00       	call   802153 <set_pgfault_handler>
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  8010b4:	b8 07 00 00 00       	mov    $0x7,%eax
  8010b9:	cd 30                	int    $0x30
  8010bb:	89 c7                	mov    %eax,%edi
  8010bd:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	//首先需要分配一个env，env_alloc是内核态调用的，因此只能去调系统调用对应的函数来请求分配一个环境描述符。
	envid=sys_exofork();
	//分配成功
	if(envid>0){
  8010c0:	83 c4 10             	add    $0x10,%esp
  8010c3:	85 c0                	test   %eax,%eax
  8010c5:	0f 8e 9d 01 00 00    	jle    801268 <fork+0x1cb>
		//接下来应该要拷贝父进程。当然这里让我吃惊的是直接可以调用对应的宏并且并没有去请求父进程。jos系统似乎是把所有的子进程都来源于同一进程，而不是父子继承关系。
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  8010cb:	bb 00 00 80 00       	mov    $0x800000,%ebx
  8010d0:	eb 5b                	jmp    80112d <fork+0x90>
			sys_page_map(0, addr, envid, addr, PTE_SYSCALL);
  8010d2:	83 ec 0c             	sub    $0xc,%esp
  8010d5:	68 07 0e 00 00       	push   $0xe07
  8010da:	56                   	push   %esi
  8010db:	ff 75 e4             	pushl  -0x1c(%ebp)
  8010de:	56                   	push   %esi
  8010df:	6a 00                	push   $0x0
  8010e1:	e8 c7 fc ff ff       	call   800dad <sys_page_map>
  8010e6:	83 c4 20             	add    $0x20,%esp
  8010e9:	eb 30                	jmp    80111b <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  8010eb:	83 ec 04             	sub    $0x4,%esp
  8010ee:	68 a0 29 80 00       	push   $0x8029a0
  8010f3:	6a 63                	push   $0x63
  8010f5:	68 5b 29 80 00       	push   $0x80295b
  8010fa:	e8 65 f1 ff ff       	call   800264 <_panic>
            r = sys_page_map(0, addr, envid, addr, PTE_U | PTE_P);
  8010ff:	83 ec 0c             	sub    $0xc,%esp
  801102:	6a 05                	push   $0x5
  801104:	56                   	push   %esi
  801105:	ff 75 e4             	pushl  -0x1c(%ebp)
  801108:	56                   	push   %esi
  801109:	6a 00                	push   $0x0
  80110b:	e8 9d fc ff ff       	call   800dad <sys_page_map>
            if(r < 0)
  801110:	83 c4 20             	add    $0x20,%esp
  801113:	85 c0                	test   %eax,%eax
  801115:	0f 88 ac 00 00 00    	js     8011c7 <fork+0x12a>
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  80111b:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  801121:	81 fb 00 e0 bf ee    	cmp    $0xeebfe000,%ebx
  801127:	0f 84 ae 00 00 00    	je     8011db <fork+0x13e>
			pn=PGNUM(pageVa);
			//检查权限，挨个copy页
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  80112d:	89 d8                	mov    %ebx,%eax
  80112f:	c1 e8 16             	shr    $0x16,%eax
  801132:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801139:	a8 01                	test   $0x1,%al
  80113b:	74 de                	je     80111b <fork+0x7e>
			pn=PGNUM(pageVa);
  80113d:	89 d8                	mov    %ebx,%eax
  80113f:	c1 e8 0c             	shr    $0xc,%eax
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  801142:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801149:	f6 c2 01             	test   $0x1,%dl
  80114c:	74 cd                	je     80111b <fork+0x7e>
  80114e:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801155:	f6 c2 04             	test   $0x4,%dl
  801158:	74 c1                	je     80111b <fork+0x7e>
        addr = (void *)((uint32_t)pn * PGSIZE);
  80115a:	89 c6                	mov    %eax,%esi
  80115c:	c1 e6 0c             	shl    $0xc,%esi
        pte = uvpt[pn];
  80115f:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
		if(pte&PTE_SHARE){
  801166:	f6 c4 04             	test   $0x4,%ah
  801169:	0f 85 63 ff ff ff    	jne    8010d2 <fork+0x35>
        else if((pte & PTE_COW) || (pte & PTE_W))
  80116f:	a9 02 08 00 00       	test   $0x802,%eax
  801174:	74 89                	je     8010ff <fork+0x62>
            r = sys_page_map(0, addr, envid, addr, PTE_COW | PTE_U | PTE_P);
  801176:	83 ec 0c             	sub    $0xc,%esp
  801179:	68 05 08 00 00       	push   $0x805
  80117e:	56                   	push   %esi
  80117f:	ff 75 e4             	pushl  -0x1c(%ebp)
  801182:	56                   	push   %esi
  801183:	6a 00                	push   $0x0
  801185:	e8 23 fc ff ff       	call   800dad <sys_page_map>
            if(r < 0)
  80118a:	83 c4 20             	add    $0x20,%esp
  80118d:	85 c0                	test   %eax,%eax
  80118f:	0f 88 56 ff ff ff    	js     8010eb <fork+0x4e>
            r = sys_page_map(0, addr, 0, addr, PTE_COW | PTE_U | PTE_P);
  801195:	83 ec 0c             	sub    $0xc,%esp
  801198:	68 05 08 00 00       	push   $0x805
  80119d:	56                   	push   %esi
  80119e:	6a 00                	push   $0x0
  8011a0:	56                   	push   %esi
  8011a1:	6a 00                	push   $0x0
  8011a3:	e8 05 fc ff ff       	call   800dad <sys_page_map>
            if(r < 0)
  8011a8:	83 c4 20             	add    $0x20,%esp
  8011ab:	85 c0                	test   %eax,%eax
  8011ad:	0f 89 68 ff ff ff    	jns    80111b <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  8011b3:	83 ec 04             	sub    $0x4,%esp
  8011b6:	68 a0 29 80 00       	push   $0x8029a0
  8011bb:	6a 66                	push   $0x66
  8011bd:	68 5b 29 80 00       	push   $0x80295b
  8011c2:	e8 9d f0 ff ff       	call   800264 <_panic>
                panic("duppage: sys_page_map fail\n");
  8011c7:	83 ec 04             	sub    $0x4,%esp
  8011ca:	68 a0 29 80 00       	push   $0x8029a0
  8011cf:	6a 6c                	push   $0x6c
  8011d1:	68 5b 29 80 00       	push   $0x80295b
  8011d6:	e8 89 f0 ff ff       	call   800264 <_panic>
				duppage(envid,pn);}
			}
		//分配异常栈。
		int32_t flag=sys_page_alloc(envid,(void*)(UXSTACKTOP-PGSIZE),PTE_P|PTE_U|PTE_W);
  8011db:	83 ec 04             	sub    $0x4,%esp
  8011de:	6a 07                	push   $0x7
  8011e0:	68 00 f0 bf ee       	push   $0xeebff000
  8011e5:	57                   	push   %edi
  8011e6:	e8 7b fb ff ff       	call   800d66 <sys_page_alloc>
		if(flag<0){
  8011eb:	83 c4 10             	add    $0x10,%esp
  8011ee:	85 c0                	test   %eax,%eax
  8011f0:	78 31                	js     801223 <fork+0x186>
			panic("panic by alloc page");
		}
		//设置对应的异常处理函数。
		extern void _pgfault_upcall(void);
		flag=sys_env_set_pgfault_upcall(envid,_pgfault_upcall);
  8011f2:	83 ec 08             	sub    $0x8,%esp
  8011f5:	68 cd 21 80 00       	push   $0x8021cd
  8011fa:	57                   	push   %edi
  8011fb:	e8 c5 fc ff ff       	call   800ec5 <sys_env_set_pgfault_upcall>
		if(flag<0){
  801200:	83 c4 10             	add    $0x10,%esp
  801203:	85 c0                	test   %eax,%eax
  801205:	78 33                	js     80123a <fork+0x19d>
			panic("panic by set pgfault upcall faction");
		}
		//设置子进程，等待调度。
		flag=sys_env_set_status(envid,ENV_RUNNABLE);
  801207:	83 ec 08             	sub    $0x8,%esp
  80120a:	6a 02                	push   $0x2
  80120c:	57                   	push   %edi
  80120d:	e8 27 fc ff ff       	call   800e39 <sys_env_set_status>
		if(flag<0){
  801212:	83 c4 10             	add    $0x10,%esp
  801215:	85 c0                	test   %eax,%eax
  801217:	78 38                	js     801251 <fork+0x1b4>
		//否则报错。
		panic("panic by alloc envid");
	}

	
}
  801219:	89 f8                	mov    %edi,%eax
  80121b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80121e:	5b                   	pop    %ebx
  80121f:	5e                   	pop    %esi
  801220:	5f                   	pop    %edi
  801221:	5d                   	pop    %ebp
  801222:	c3                   	ret    
			panic("panic by alloc page");
  801223:	83 ec 04             	sub    $0x4,%esp
  801226:	68 bc 29 80 00       	push   $0x8029bc
  80122b:	68 98 00 00 00       	push   $0x98
  801230:	68 5b 29 80 00       	push   $0x80295b
  801235:	e8 2a f0 ff ff       	call   800264 <_panic>
			panic("panic by set pgfault upcall faction");
  80123a:	83 ec 04             	sub    $0x4,%esp
  80123d:	68 10 29 80 00       	push   $0x802910
  801242:	68 9e 00 00 00       	push   $0x9e
  801247:	68 5b 29 80 00       	push   $0x80295b
  80124c:	e8 13 f0 ff ff       	call   800264 <_panic>
			panic("panic by set env status to ENV_RUNABLE");
  801251:	83 ec 04             	sub    $0x4,%esp
  801254:	68 34 29 80 00       	push   $0x802934
  801259:	68 a3 00 00 00       	push   $0xa3
  80125e:	68 5b 29 80 00       	push   $0x80295b
  801263:	e8 fc ef ff ff       	call   800264 <_panic>
	else if(envid==0){
  801268:	75 19                	jne    801283 <fork+0x1e6>
        thisenv = &envs[ENVX(sys_getenvid())];	//在子进程中设置thisenv为自己
  80126a:	e8 b1 fa ff ff       	call   800d20 <sys_getenvid>
  80126f:	25 ff 03 00 00       	and    $0x3ff,%eax
  801274:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801277:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  80127c:	a3 04 40 80 00       	mov    %eax,0x804004
		return 0;
  801281:	eb 96                	jmp    801219 <fork+0x17c>
		panic("panic by alloc envid");
  801283:	83 ec 04             	sub    $0x4,%esp
  801286:	68 d0 29 80 00       	push   $0x8029d0
  80128b:	68 ad 00 00 00       	push   $0xad
  801290:	68 5b 29 80 00       	push   $0x80295b
  801295:	e8 ca ef ff ff       	call   800264 <_panic>

0080129a <sfork>:

// Challenge!
int
sfork(void)
{
  80129a:	f3 0f 1e fb          	endbr32 
  80129e:	55                   	push   %ebp
  80129f:	89 e5                	mov    %esp,%ebp
  8012a1:	83 ec 0c             	sub    $0xc,%esp
	panic("sfork not implemented");
  8012a4:	68 e5 29 80 00       	push   $0x8029e5
  8012a9:	68 b7 00 00 00       	push   $0xb7
  8012ae:	68 5b 29 80 00       	push   $0x80295b
  8012b3:	e8 ac ef ff ff       	call   800264 <_panic>

008012b8 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  8012b8:	f3 0f 1e fb          	endbr32 
  8012bc:	55                   	push   %ebp
  8012bd:	89 e5                	mov    %esp,%ebp
  8012bf:	56                   	push   %esi
  8012c0:	53                   	push   %ebx
  8012c1:	8b 75 08             	mov    0x8(%ebp),%esi
  8012c4:	8b 45 0c             	mov    0xc(%ebp),%eax
  8012c7:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  8012ca:	85 c0                	test   %eax,%eax
  8012cc:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  8012d1:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  8012d4:	83 ec 0c             	sub    $0xc,%esp
  8012d7:	50                   	push   %eax
  8012d8:	e8 55 fc ff ff       	call   800f32 <sys_ipc_recv>
  8012dd:	83 c4 10             	add    $0x10,%esp
  8012e0:	85 c0                	test   %eax,%eax
  8012e2:	78 3f                	js     801323 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  8012e4:	e8 37 fa ff ff       	call   800d20 <sys_getenvid>
  8012e9:	25 ff 03 00 00       	and    $0x3ff,%eax
  8012ee:	6b d0 7c             	imul   $0x7c,%eax,%edx
  8012f1:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  8012f7:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  8012fd:	85 f6                	test   %esi,%esi
  8012ff:	74 05                	je     801306 <ipc_recv+0x4e>
  801301:	8b 42 74             	mov    0x74(%edx),%eax
  801304:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801306:	85 db                	test   %ebx,%ebx
  801308:	74 0a                	je     801314 <ipc_recv+0x5c>
  80130a:	a1 04 40 80 00       	mov    0x804004,%eax
  80130f:	8b 40 78             	mov    0x78(%eax),%eax
  801312:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801314:	a1 04 40 80 00       	mov    0x804004,%eax
  801319:	8b 40 70             	mov    0x70(%eax),%eax
}
  80131c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80131f:	5b                   	pop    %ebx
  801320:	5e                   	pop    %esi
  801321:	5d                   	pop    %ebp
  801322:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  801323:	85 f6                	test   %esi,%esi
  801325:	74 06                	je     80132d <ipc_recv+0x75>
  801327:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  80132d:	85 db                	test   %ebx,%ebx
  80132f:	74 eb                	je     80131c <ipc_recv+0x64>
  801331:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  801337:	eb e3                	jmp    80131c <ipc_recv+0x64>

00801339 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  801339:	f3 0f 1e fb          	endbr32 
  80133d:	55                   	push   %ebp
  80133e:	89 e5                	mov    %esp,%ebp
  801340:	57                   	push   %edi
  801341:	56                   	push   %esi
  801342:	53                   	push   %ebx
  801343:	83 ec 0c             	sub    $0xc,%esp
  801346:	8b 7d 08             	mov    0x8(%ebp),%edi
  801349:	8b 75 0c             	mov    0xc(%ebp),%esi
  80134c:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  80134f:	85 db                	test   %ebx,%ebx
  801351:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  801356:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  801359:	ff 75 14             	pushl  0x14(%ebp)
  80135c:	53                   	push   %ebx
  80135d:	56                   	push   %esi
  80135e:	57                   	push   %edi
  80135f:	e8 a7 fb ff ff       	call   800f0b <sys_ipc_try_send>
  801364:	83 c4 10             	add    $0x10,%esp
  801367:	85 c0                	test   %eax,%eax
  801369:	79 1e                	jns    801389 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  80136b:	83 f8 f9             	cmp    $0xfffffff9,%eax
  80136e:	75 07                	jne    801377 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  801370:	e8 ce f9 ff ff       	call   800d43 <sys_yield>
  801375:	eb e2                	jmp    801359 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  801377:	50                   	push   %eax
  801378:	68 fb 29 80 00       	push   $0x8029fb
  80137d:	6a 3b                	push   $0x3b
  80137f:	68 0f 2a 80 00       	push   $0x802a0f
  801384:	e8 db ee ff ff       	call   800264 <_panic>
	}
}
  801389:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80138c:	5b                   	pop    %ebx
  80138d:	5e                   	pop    %esi
  80138e:	5f                   	pop    %edi
  80138f:	5d                   	pop    %ebp
  801390:	c3                   	ret    

00801391 <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  801391:	f3 0f 1e fb          	endbr32 
  801395:	55                   	push   %ebp
  801396:	89 e5                	mov    %esp,%ebp
  801398:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  80139b:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  8013a0:	6b d0 7c             	imul   $0x7c,%eax,%edx
  8013a3:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  8013a9:	8b 52 50             	mov    0x50(%edx),%edx
  8013ac:	39 ca                	cmp    %ecx,%edx
  8013ae:	74 11                	je     8013c1 <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  8013b0:	83 c0 01             	add    $0x1,%eax
  8013b3:	3d 00 04 00 00       	cmp    $0x400,%eax
  8013b8:	75 e6                	jne    8013a0 <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  8013ba:	b8 00 00 00 00       	mov    $0x0,%eax
  8013bf:	eb 0b                	jmp    8013cc <ipc_find_env+0x3b>
			return envs[i].env_id;
  8013c1:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8013c4:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8013c9:	8b 40 48             	mov    0x48(%eax),%eax
}
  8013cc:	5d                   	pop    %ebp
  8013cd:	c3                   	ret    

008013ce <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  8013ce:	f3 0f 1e fb          	endbr32 
  8013d2:	55                   	push   %ebp
  8013d3:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8013d5:	8b 45 08             	mov    0x8(%ebp),%eax
  8013d8:	05 00 00 00 30       	add    $0x30000000,%eax
  8013dd:	c1 e8 0c             	shr    $0xc,%eax
}
  8013e0:	5d                   	pop    %ebp
  8013e1:	c3                   	ret    

008013e2 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  8013e2:	f3 0f 1e fb          	endbr32 
  8013e6:	55                   	push   %ebp
  8013e7:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8013e9:	8b 45 08             	mov    0x8(%ebp),%eax
  8013ec:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  8013f1:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  8013f6:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  8013fb:	5d                   	pop    %ebp
  8013fc:	c3                   	ret    

008013fd <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  8013fd:	f3 0f 1e fb          	endbr32 
  801401:	55                   	push   %ebp
  801402:	89 e5                	mov    %esp,%ebp
  801404:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  801409:	89 c2                	mov    %eax,%edx
  80140b:	c1 ea 16             	shr    $0x16,%edx
  80140e:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  801415:	f6 c2 01             	test   $0x1,%dl
  801418:	74 2d                	je     801447 <fd_alloc+0x4a>
  80141a:	89 c2                	mov    %eax,%edx
  80141c:	c1 ea 0c             	shr    $0xc,%edx
  80141f:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801426:	f6 c2 01             	test   $0x1,%dl
  801429:	74 1c                	je     801447 <fd_alloc+0x4a>
  80142b:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  801430:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  801435:	75 d2                	jne    801409 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  801437:	8b 45 08             	mov    0x8(%ebp),%eax
  80143a:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  801440:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  801445:	eb 0a                	jmp    801451 <fd_alloc+0x54>
			*fd_store = fd;
  801447:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80144a:	89 01                	mov    %eax,(%ecx)
			return 0;
  80144c:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801451:	5d                   	pop    %ebp
  801452:	c3                   	ret    

00801453 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  801453:	f3 0f 1e fb          	endbr32 
  801457:	55                   	push   %ebp
  801458:	89 e5                	mov    %esp,%ebp
  80145a:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  80145d:	83 f8 1f             	cmp    $0x1f,%eax
  801460:	77 30                	ja     801492 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  801462:	c1 e0 0c             	shl    $0xc,%eax
  801465:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  80146a:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  801470:	f6 c2 01             	test   $0x1,%dl
  801473:	74 24                	je     801499 <fd_lookup+0x46>
  801475:	89 c2                	mov    %eax,%edx
  801477:	c1 ea 0c             	shr    $0xc,%edx
  80147a:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801481:	f6 c2 01             	test   $0x1,%dl
  801484:	74 1a                	je     8014a0 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  801486:	8b 55 0c             	mov    0xc(%ebp),%edx
  801489:	89 02                	mov    %eax,(%edx)
	return 0;
  80148b:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801490:	5d                   	pop    %ebp
  801491:	c3                   	ret    
		return -E_INVAL;
  801492:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801497:	eb f7                	jmp    801490 <fd_lookup+0x3d>
		return -E_INVAL;
  801499:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80149e:	eb f0                	jmp    801490 <fd_lookup+0x3d>
  8014a0:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8014a5:	eb e9                	jmp    801490 <fd_lookup+0x3d>

008014a7 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  8014a7:	f3 0f 1e fb          	endbr32 
  8014ab:	55                   	push   %ebp
  8014ac:	89 e5                	mov    %esp,%ebp
  8014ae:	83 ec 08             	sub    $0x8,%esp
  8014b1:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8014b4:	ba 98 2a 80 00       	mov    $0x802a98,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  8014b9:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  8014be:	39 08                	cmp    %ecx,(%eax)
  8014c0:	74 33                	je     8014f5 <dev_lookup+0x4e>
  8014c2:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  8014c5:	8b 02                	mov    (%edx),%eax
  8014c7:	85 c0                	test   %eax,%eax
  8014c9:	75 f3                	jne    8014be <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  8014cb:	a1 04 40 80 00       	mov    0x804004,%eax
  8014d0:	8b 40 48             	mov    0x48(%eax),%eax
  8014d3:	83 ec 04             	sub    $0x4,%esp
  8014d6:	51                   	push   %ecx
  8014d7:	50                   	push   %eax
  8014d8:	68 1c 2a 80 00       	push   $0x802a1c
  8014dd:	e8 69 ee ff ff       	call   80034b <cprintf>
	*dev = 0;
  8014e2:	8b 45 0c             	mov    0xc(%ebp),%eax
  8014e5:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  8014eb:	83 c4 10             	add    $0x10,%esp
  8014ee:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  8014f3:	c9                   	leave  
  8014f4:	c3                   	ret    
			*dev = devtab[i];
  8014f5:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8014f8:	89 01                	mov    %eax,(%ecx)
			return 0;
  8014fa:	b8 00 00 00 00       	mov    $0x0,%eax
  8014ff:	eb f2                	jmp    8014f3 <dev_lookup+0x4c>

00801501 <fd_close>:
{
  801501:	f3 0f 1e fb          	endbr32 
  801505:	55                   	push   %ebp
  801506:	89 e5                	mov    %esp,%ebp
  801508:	57                   	push   %edi
  801509:	56                   	push   %esi
  80150a:	53                   	push   %ebx
  80150b:	83 ec 24             	sub    $0x24,%esp
  80150e:	8b 75 08             	mov    0x8(%ebp),%esi
  801511:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801514:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  801517:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801518:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  80151e:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801521:	50                   	push   %eax
  801522:	e8 2c ff ff ff       	call   801453 <fd_lookup>
  801527:	89 c3                	mov    %eax,%ebx
  801529:	83 c4 10             	add    $0x10,%esp
  80152c:	85 c0                	test   %eax,%eax
  80152e:	78 05                	js     801535 <fd_close+0x34>
	    || fd != fd2)
  801530:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  801533:	74 16                	je     80154b <fd_close+0x4a>
		return (must_exist ? r : 0);
  801535:	89 f8                	mov    %edi,%eax
  801537:	84 c0                	test   %al,%al
  801539:	b8 00 00 00 00       	mov    $0x0,%eax
  80153e:	0f 44 d8             	cmove  %eax,%ebx
}
  801541:	89 d8                	mov    %ebx,%eax
  801543:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801546:	5b                   	pop    %ebx
  801547:	5e                   	pop    %esi
  801548:	5f                   	pop    %edi
  801549:	5d                   	pop    %ebp
  80154a:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  80154b:	83 ec 08             	sub    $0x8,%esp
  80154e:	8d 45 e0             	lea    -0x20(%ebp),%eax
  801551:	50                   	push   %eax
  801552:	ff 36                	pushl  (%esi)
  801554:	e8 4e ff ff ff       	call   8014a7 <dev_lookup>
  801559:	89 c3                	mov    %eax,%ebx
  80155b:	83 c4 10             	add    $0x10,%esp
  80155e:	85 c0                	test   %eax,%eax
  801560:	78 1a                	js     80157c <fd_close+0x7b>
		if (dev->dev_close)
  801562:	8b 45 e0             	mov    -0x20(%ebp),%eax
  801565:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  801568:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  80156d:	85 c0                	test   %eax,%eax
  80156f:	74 0b                	je     80157c <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  801571:	83 ec 0c             	sub    $0xc,%esp
  801574:	56                   	push   %esi
  801575:	ff d0                	call   *%eax
  801577:	89 c3                	mov    %eax,%ebx
  801579:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  80157c:	83 ec 08             	sub    $0x8,%esp
  80157f:	56                   	push   %esi
  801580:	6a 00                	push   $0x0
  801582:	e8 6c f8 ff ff       	call   800df3 <sys_page_unmap>
	return r;
  801587:	83 c4 10             	add    $0x10,%esp
  80158a:	eb b5                	jmp    801541 <fd_close+0x40>

0080158c <close>:

int
close(int fdnum)
{
  80158c:	f3 0f 1e fb          	endbr32 
  801590:	55                   	push   %ebp
  801591:	89 e5                	mov    %esp,%ebp
  801593:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801596:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801599:	50                   	push   %eax
  80159a:	ff 75 08             	pushl  0x8(%ebp)
  80159d:	e8 b1 fe ff ff       	call   801453 <fd_lookup>
  8015a2:	83 c4 10             	add    $0x10,%esp
  8015a5:	85 c0                	test   %eax,%eax
  8015a7:	79 02                	jns    8015ab <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  8015a9:	c9                   	leave  
  8015aa:	c3                   	ret    
		return fd_close(fd, 1);
  8015ab:	83 ec 08             	sub    $0x8,%esp
  8015ae:	6a 01                	push   $0x1
  8015b0:	ff 75 f4             	pushl  -0xc(%ebp)
  8015b3:	e8 49 ff ff ff       	call   801501 <fd_close>
  8015b8:	83 c4 10             	add    $0x10,%esp
  8015bb:	eb ec                	jmp    8015a9 <close+0x1d>

008015bd <close_all>:

void
close_all(void)
{
  8015bd:	f3 0f 1e fb          	endbr32 
  8015c1:	55                   	push   %ebp
  8015c2:	89 e5                	mov    %esp,%ebp
  8015c4:	53                   	push   %ebx
  8015c5:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  8015c8:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  8015cd:	83 ec 0c             	sub    $0xc,%esp
  8015d0:	53                   	push   %ebx
  8015d1:	e8 b6 ff ff ff       	call   80158c <close>
	for (i = 0; i < MAXFD; i++)
  8015d6:	83 c3 01             	add    $0x1,%ebx
  8015d9:	83 c4 10             	add    $0x10,%esp
  8015dc:	83 fb 20             	cmp    $0x20,%ebx
  8015df:	75 ec                	jne    8015cd <close_all+0x10>
}
  8015e1:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8015e4:	c9                   	leave  
  8015e5:	c3                   	ret    

008015e6 <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  8015e6:	f3 0f 1e fb          	endbr32 
  8015ea:	55                   	push   %ebp
  8015eb:	89 e5                	mov    %esp,%ebp
  8015ed:	57                   	push   %edi
  8015ee:	56                   	push   %esi
  8015ef:	53                   	push   %ebx
  8015f0:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  8015f3:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8015f6:	50                   	push   %eax
  8015f7:	ff 75 08             	pushl  0x8(%ebp)
  8015fa:	e8 54 fe ff ff       	call   801453 <fd_lookup>
  8015ff:	89 c3                	mov    %eax,%ebx
  801601:	83 c4 10             	add    $0x10,%esp
  801604:	85 c0                	test   %eax,%eax
  801606:	0f 88 81 00 00 00    	js     80168d <dup+0xa7>
		return r;
	close(newfdnum);
  80160c:	83 ec 0c             	sub    $0xc,%esp
  80160f:	ff 75 0c             	pushl  0xc(%ebp)
  801612:	e8 75 ff ff ff       	call   80158c <close>

	newfd = INDEX2FD(newfdnum);
  801617:	8b 75 0c             	mov    0xc(%ebp),%esi
  80161a:	c1 e6 0c             	shl    $0xc,%esi
  80161d:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  801623:	83 c4 04             	add    $0x4,%esp
  801626:	ff 75 e4             	pushl  -0x1c(%ebp)
  801629:	e8 b4 fd ff ff       	call   8013e2 <fd2data>
  80162e:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  801630:	89 34 24             	mov    %esi,(%esp)
  801633:	e8 aa fd ff ff       	call   8013e2 <fd2data>
  801638:	83 c4 10             	add    $0x10,%esp
  80163b:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  80163d:	89 d8                	mov    %ebx,%eax
  80163f:	c1 e8 16             	shr    $0x16,%eax
  801642:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801649:	a8 01                	test   $0x1,%al
  80164b:	74 11                	je     80165e <dup+0x78>
  80164d:	89 d8                	mov    %ebx,%eax
  80164f:	c1 e8 0c             	shr    $0xc,%eax
  801652:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801659:	f6 c2 01             	test   $0x1,%dl
  80165c:	75 39                	jne    801697 <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  80165e:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  801661:	89 d0                	mov    %edx,%eax
  801663:	c1 e8 0c             	shr    $0xc,%eax
  801666:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  80166d:	83 ec 0c             	sub    $0xc,%esp
  801670:	25 07 0e 00 00       	and    $0xe07,%eax
  801675:	50                   	push   %eax
  801676:	56                   	push   %esi
  801677:	6a 00                	push   $0x0
  801679:	52                   	push   %edx
  80167a:	6a 00                	push   $0x0
  80167c:	e8 2c f7 ff ff       	call   800dad <sys_page_map>
  801681:	89 c3                	mov    %eax,%ebx
  801683:	83 c4 20             	add    $0x20,%esp
  801686:	85 c0                	test   %eax,%eax
  801688:	78 31                	js     8016bb <dup+0xd5>
		goto err;

	return newfdnum;
  80168a:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  80168d:	89 d8                	mov    %ebx,%eax
  80168f:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801692:	5b                   	pop    %ebx
  801693:	5e                   	pop    %esi
  801694:	5f                   	pop    %edi
  801695:	5d                   	pop    %ebp
  801696:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  801697:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  80169e:	83 ec 0c             	sub    $0xc,%esp
  8016a1:	25 07 0e 00 00       	and    $0xe07,%eax
  8016a6:	50                   	push   %eax
  8016a7:	57                   	push   %edi
  8016a8:	6a 00                	push   $0x0
  8016aa:	53                   	push   %ebx
  8016ab:	6a 00                	push   $0x0
  8016ad:	e8 fb f6 ff ff       	call   800dad <sys_page_map>
  8016b2:	89 c3                	mov    %eax,%ebx
  8016b4:	83 c4 20             	add    $0x20,%esp
  8016b7:	85 c0                	test   %eax,%eax
  8016b9:	79 a3                	jns    80165e <dup+0x78>
	sys_page_unmap(0, newfd);
  8016bb:	83 ec 08             	sub    $0x8,%esp
  8016be:	56                   	push   %esi
  8016bf:	6a 00                	push   $0x0
  8016c1:	e8 2d f7 ff ff       	call   800df3 <sys_page_unmap>
	sys_page_unmap(0, nva);
  8016c6:	83 c4 08             	add    $0x8,%esp
  8016c9:	57                   	push   %edi
  8016ca:	6a 00                	push   $0x0
  8016cc:	e8 22 f7 ff ff       	call   800df3 <sys_page_unmap>
	return r;
  8016d1:	83 c4 10             	add    $0x10,%esp
  8016d4:	eb b7                	jmp    80168d <dup+0xa7>

008016d6 <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  8016d6:	f3 0f 1e fb          	endbr32 
  8016da:	55                   	push   %ebp
  8016db:	89 e5                	mov    %esp,%ebp
  8016dd:	53                   	push   %ebx
  8016de:	83 ec 1c             	sub    $0x1c,%esp
  8016e1:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8016e4:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8016e7:	50                   	push   %eax
  8016e8:	53                   	push   %ebx
  8016e9:	e8 65 fd ff ff       	call   801453 <fd_lookup>
  8016ee:	83 c4 10             	add    $0x10,%esp
  8016f1:	85 c0                	test   %eax,%eax
  8016f3:	78 3f                	js     801734 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8016f5:	83 ec 08             	sub    $0x8,%esp
  8016f8:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8016fb:	50                   	push   %eax
  8016fc:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8016ff:	ff 30                	pushl  (%eax)
  801701:	e8 a1 fd ff ff       	call   8014a7 <dev_lookup>
  801706:	83 c4 10             	add    $0x10,%esp
  801709:	85 c0                	test   %eax,%eax
  80170b:	78 27                	js     801734 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  80170d:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801710:	8b 42 08             	mov    0x8(%edx),%eax
  801713:	83 e0 03             	and    $0x3,%eax
  801716:	83 f8 01             	cmp    $0x1,%eax
  801719:	74 1e                	je     801739 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  80171b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80171e:	8b 40 08             	mov    0x8(%eax),%eax
  801721:	85 c0                	test   %eax,%eax
  801723:	74 35                	je     80175a <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  801725:	83 ec 04             	sub    $0x4,%esp
  801728:	ff 75 10             	pushl  0x10(%ebp)
  80172b:	ff 75 0c             	pushl  0xc(%ebp)
  80172e:	52                   	push   %edx
  80172f:	ff d0                	call   *%eax
  801731:	83 c4 10             	add    $0x10,%esp
}
  801734:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801737:	c9                   	leave  
  801738:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  801739:	a1 04 40 80 00       	mov    0x804004,%eax
  80173e:	8b 40 48             	mov    0x48(%eax),%eax
  801741:	83 ec 04             	sub    $0x4,%esp
  801744:	53                   	push   %ebx
  801745:	50                   	push   %eax
  801746:	68 5d 2a 80 00       	push   $0x802a5d
  80174b:	e8 fb eb ff ff       	call   80034b <cprintf>
		return -E_INVAL;
  801750:	83 c4 10             	add    $0x10,%esp
  801753:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801758:	eb da                	jmp    801734 <read+0x5e>
		return -E_NOT_SUPP;
  80175a:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80175f:	eb d3                	jmp    801734 <read+0x5e>

00801761 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  801761:	f3 0f 1e fb          	endbr32 
  801765:	55                   	push   %ebp
  801766:	89 e5                	mov    %esp,%ebp
  801768:	57                   	push   %edi
  801769:	56                   	push   %esi
  80176a:	53                   	push   %ebx
  80176b:	83 ec 0c             	sub    $0xc,%esp
  80176e:	8b 7d 08             	mov    0x8(%ebp),%edi
  801771:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  801774:	bb 00 00 00 00       	mov    $0x0,%ebx
  801779:	eb 02                	jmp    80177d <readn+0x1c>
  80177b:	01 c3                	add    %eax,%ebx
  80177d:	39 f3                	cmp    %esi,%ebx
  80177f:	73 21                	jae    8017a2 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801781:	83 ec 04             	sub    $0x4,%esp
  801784:	89 f0                	mov    %esi,%eax
  801786:	29 d8                	sub    %ebx,%eax
  801788:	50                   	push   %eax
  801789:	89 d8                	mov    %ebx,%eax
  80178b:	03 45 0c             	add    0xc(%ebp),%eax
  80178e:	50                   	push   %eax
  80178f:	57                   	push   %edi
  801790:	e8 41 ff ff ff       	call   8016d6 <read>
		if (m < 0)
  801795:	83 c4 10             	add    $0x10,%esp
  801798:	85 c0                	test   %eax,%eax
  80179a:	78 04                	js     8017a0 <readn+0x3f>
			return m;
		if (m == 0)
  80179c:	75 dd                	jne    80177b <readn+0x1a>
  80179e:	eb 02                	jmp    8017a2 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8017a0:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  8017a2:	89 d8                	mov    %ebx,%eax
  8017a4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8017a7:	5b                   	pop    %ebx
  8017a8:	5e                   	pop    %esi
  8017a9:	5f                   	pop    %edi
  8017aa:	5d                   	pop    %ebp
  8017ab:	c3                   	ret    

008017ac <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  8017ac:	f3 0f 1e fb          	endbr32 
  8017b0:	55                   	push   %ebp
  8017b1:	89 e5                	mov    %esp,%ebp
  8017b3:	53                   	push   %ebx
  8017b4:	83 ec 1c             	sub    $0x1c,%esp
  8017b7:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8017ba:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8017bd:	50                   	push   %eax
  8017be:	53                   	push   %ebx
  8017bf:	e8 8f fc ff ff       	call   801453 <fd_lookup>
  8017c4:	83 c4 10             	add    $0x10,%esp
  8017c7:	85 c0                	test   %eax,%eax
  8017c9:	78 3a                	js     801805 <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8017cb:	83 ec 08             	sub    $0x8,%esp
  8017ce:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8017d1:	50                   	push   %eax
  8017d2:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8017d5:	ff 30                	pushl  (%eax)
  8017d7:	e8 cb fc ff ff       	call   8014a7 <dev_lookup>
  8017dc:	83 c4 10             	add    $0x10,%esp
  8017df:	85 c0                	test   %eax,%eax
  8017e1:	78 22                	js     801805 <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8017e3:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8017e6:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8017ea:	74 1e                	je     80180a <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  8017ec:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8017ef:	8b 52 0c             	mov    0xc(%edx),%edx
  8017f2:	85 d2                	test   %edx,%edx
  8017f4:	74 35                	je     80182b <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  8017f6:	83 ec 04             	sub    $0x4,%esp
  8017f9:	ff 75 10             	pushl  0x10(%ebp)
  8017fc:	ff 75 0c             	pushl  0xc(%ebp)
  8017ff:	50                   	push   %eax
  801800:	ff d2                	call   *%edx
  801802:	83 c4 10             	add    $0x10,%esp
}
  801805:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801808:	c9                   	leave  
  801809:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  80180a:	a1 04 40 80 00       	mov    0x804004,%eax
  80180f:	8b 40 48             	mov    0x48(%eax),%eax
  801812:	83 ec 04             	sub    $0x4,%esp
  801815:	53                   	push   %ebx
  801816:	50                   	push   %eax
  801817:	68 79 2a 80 00       	push   $0x802a79
  80181c:	e8 2a eb ff ff       	call   80034b <cprintf>
		return -E_INVAL;
  801821:	83 c4 10             	add    $0x10,%esp
  801824:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801829:	eb da                	jmp    801805 <write+0x59>
		return -E_NOT_SUPP;
  80182b:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801830:	eb d3                	jmp    801805 <write+0x59>

00801832 <seek>:

int
seek(int fdnum, off_t offset)
{
  801832:	f3 0f 1e fb          	endbr32 
  801836:	55                   	push   %ebp
  801837:	89 e5                	mov    %esp,%ebp
  801839:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  80183c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80183f:	50                   	push   %eax
  801840:	ff 75 08             	pushl  0x8(%ebp)
  801843:	e8 0b fc ff ff       	call   801453 <fd_lookup>
  801848:	83 c4 10             	add    $0x10,%esp
  80184b:	85 c0                	test   %eax,%eax
  80184d:	78 0e                	js     80185d <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  80184f:	8b 55 0c             	mov    0xc(%ebp),%edx
  801852:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801855:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  801858:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80185d:	c9                   	leave  
  80185e:	c3                   	ret    

0080185f <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  80185f:	f3 0f 1e fb          	endbr32 
  801863:	55                   	push   %ebp
  801864:	89 e5                	mov    %esp,%ebp
  801866:	53                   	push   %ebx
  801867:	83 ec 1c             	sub    $0x1c,%esp
  80186a:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  80186d:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801870:	50                   	push   %eax
  801871:	53                   	push   %ebx
  801872:	e8 dc fb ff ff       	call   801453 <fd_lookup>
  801877:	83 c4 10             	add    $0x10,%esp
  80187a:	85 c0                	test   %eax,%eax
  80187c:	78 37                	js     8018b5 <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80187e:	83 ec 08             	sub    $0x8,%esp
  801881:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801884:	50                   	push   %eax
  801885:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801888:	ff 30                	pushl  (%eax)
  80188a:	e8 18 fc ff ff       	call   8014a7 <dev_lookup>
  80188f:	83 c4 10             	add    $0x10,%esp
  801892:	85 c0                	test   %eax,%eax
  801894:	78 1f                	js     8018b5 <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801896:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801899:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  80189d:	74 1b                	je     8018ba <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  80189f:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8018a2:	8b 52 18             	mov    0x18(%edx),%edx
  8018a5:	85 d2                	test   %edx,%edx
  8018a7:	74 32                	je     8018db <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  8018a9:	83 ec 08             	sub    $0x8,%esp
  8018ac:	ff 75 0c             	pushl  0xc(%ebp)
  8018af:	50                   	push   %eax
  8018b0:	ff d2                	call   *%edx
  8018b2:	83 c4 10             	add    $0x10,%esp
}
  8018b5:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8018b8:	c9                   	leave  
  8018b9:	c3                   	ret    
			thisenv->env_id, fdnum);
  8018ba:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  8018bf:	8b 40 48             	mov    0x48(%eax),%eax
  8018c2:	83 ec 04             	sub    $0x4,%esp
  8018c5:	53                   	push   %ebx
  8018c6:	50                   	push   %eax
  8018c7:	68 3c 2a 80 00       	push   $0x802a3c
  8018cc:	e8 7a ea ff ff       	call   80034b <cprintf>
		return -E_INVAL;
  8018d1:	83 c4 10             	add    $0x10,%esp
  8018d4:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8018d9:	eb da                	jmp    8018b5 <ftruncate+0x56>
		return -E_NOT_SUPP;
  8018db:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8018e0:	eb d3                	jmp    8018b5 <ftruncate+0x56>

008018e2 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  8018e2:	f3 0f 1e fb          	endbr32 
  8018e6:	55                   	push   %ebp
  8018e7:	89 e5                	mov    %esp,%ebp
  8018e9:	53                   	push   %ebx
  8018ea:	83 ec 1c             	sub    $0x1c,%esp
  8018ed:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8018f0:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8018f3:	50                   	push   %eax
  8018f4:	ff 75 08             	pushl  0x8(%ebp)
  8018f7:	e8 57 fb ff ff       	call   801453 <fd_lookup>
  8018fc:	83 c4 10             	add    $0x10,%esp
  8018ff:	85 c0                	test   %eax,%eax
  801901:	78 4b                	js     80194e <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801903:	83 ec 08             	sub    $0x8,%esp
  801906:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801909:	50                   	push   %eax
  80190a:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80190d:	ff 30                	pushl  (%eax)
  80190f:	e8 93 fb ff ff       	call   8014a7 <dev_lookup>
  801914:	83 c4 10             	add    $0x10,%esp
  801917:	85 c0                	test   %eax,%eax
  801919:	78 33                	js     80194e <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  80191b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80191e:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  801922:	74 2f                	je     801953 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  801924:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  801927:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  80192e:	00 00 00 
	stat->st_isdir = 0;
  801931:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801938:	00 00 00 
	stat->st_dev = dev;
  80193b:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  801941:	83 ec 08             	sub    $0x8,%esp
  801944:	53                   	push   %ebx
  801945:	ff 75 f0             	pushl  -0x10(%ebp)
  801948:	ff 50 14             	call   *0x14(%eax)
  80194b:	83 c4 10             	add    $0x10,%esp
}
  80194e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801951:	c9                   	leave  
  801952:	c3                   	ret    
		return -E_NOT_SUPP;
  801953:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801958:	eb f4                	jmp    80194e <fstat+0x6c>

0080195a <stat>:

int
stat(const char *path, struct Stat *stat)
{
  80195a:	f3 0f 1e fb          	endbr32 
  80195e:	55                   	push   %ebp
  80195f:	89 e5                	mov    %esp,%ebp
  801961:	56                   	push   %esi
  801962:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  801963:	83 ec 08             	sub    $0x8,%esp
  801966:	6a 00                	push   $0x0
  801968:	ff 75 08             	pushl  0x8(%ebp)
  80196b:	e8 fb 01 00 00       	call   801b6b <open>
  801970:	89 c3                	mov    %eax,%ebx
  801972:	83 c4 10             	add    $0x10,%esp
  801975:	85 c0                	test   %eax,%eax
  801977:	78 1b                	js     801994 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  801979:	83 ec 08             	sub    $0x8,%esp
  80197c:	ff 75 0c             	pushl  0xc(%ebp)
  80197f:	50                   	push   %eax
  801980:	e8 5d ff ff ff       	call   8018e2 <fstat>
  801985:	89 c6                	mov    %eax,%esi
	close(fd);
  801987:	89 1c 24             	mov    %ebx,(%esp)
  80198a:	e8 fd fb ff ff       	call   80158c <close>
	return r;
  80198f:	83 c4 10             	add    $0x10,%esp
  801992:	89 f3                	mov    %esi,%ebx
}
  801994:	89 d8                	mov    %ebx,%eax
  801996:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801999:	5b                   	pop    %ebx
  80199a:	5e                   	pop    %esi
  80199b:	5d                   	pop    %ebp
  80199c:	c3                   	ret    

0080199d <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  80199d:	55                   	push   %ebp
  80199e:	89 e5                	mov    %esp,%ebp
  8019a0:	56                   	push   %esi
  8019a1:	53                   	push   %ebx
  8019a2:	89 c6                	mov    %eax,%esi
  8019a4:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  8019a6:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  8019ad:	74 27                	je     8019d6 <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  8019af:	6a 07                	push   $0x7
  8019b1:	68 00 50 80 00       	push   $0x805000
  8019b6:	56                   	push   %esi
  8019b7:	ff 35 00 40 80 00    	pushl  0x804000
  8019bd:	e8 77 f9 ff ff       	call   801339 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  8019c2:	83 c4 0c             	add    $0xc,%esp
  8019c5:	6a 00                	push   $0x0
  8019c7:	53                   	push   %ebx
  8019c8:	6a 00                	push   $0x0
  8019ca:	e8 e9 f8 ff ff       	call   8012b8 <ipc_recv>
}
  8019cf:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8019d2:	5b                   	pop    %ebx
  8019d3:	5e                   	pop    %esi
  8019d4:	5d                   	pop    %ebp
  8019d5:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  8019d6:	83 ec 0c             	sub    $0xc,%esp
  8019d9:	6a 01                	push   $0x1
  8019db:	e8 b1 f9 ff ff       	call   801391 <ipc_find_env>
  8019e0:	a3 00 40 80 00       	mov    %eax,0x804000
  8019e5:	83 c4 10             	add    $0x10,%esp
  8019e8:	eb c5                	jmp    8019af <fsipc+0x12>

008019ea <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  8019ea:	f3 0f 1e fb          	endbr32 
  8019ee:	55                   	push   %ebp
  8019ef:	89 e5                	mov    %esp,%ebp
  8019f1:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  8019f4:	8b 45 08             	mov    0x8(%ebp),%eax
  8019f7:	8b 40 0c             	mov    0xc(%eax),%eax
  8019fa:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  8019ff:	8b 45 0c             	mov    0xc(%ebp),%eax
  801a02:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  801a07:	ba 00 00 00 00       	mov    $0x0,%edx
  801a0c:	b8 02 00 00 00       	mov    $0x2,%eax
  801a11:	e8 87 ff ff ff       	call   80199d <fsipc>
}
  801a16:	c9                   	leave  
  801a17:	c3                   	ret    

00801a18 <devfile_flush>:
{
  801a18:	f3 0f 1e fb          	endbr32 
  801a1c:	55                   	push   %ebp
  801a1d:	89 e5                	mov    %esp,%ebp
  801a1f:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  801a22:	8b 45 08             	mov    0x8(%ebp),%eax
  801a25:	8b 40 0c             	mov    0xc(%eax),%eax
  801a28:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  801a2d:	ba 00 00 00 00       	mov    $0x0,%edx
  801a32:	b8 06 00 00 00       	mov    $0x6,%eax
  801a37:	e8 61 ff ff ff       	call   80199d <fsipc>
}
  801a3c:	c9                   	leave  
  801a3d:	c3                   	ret    

00801a3e <devfile_stat>:
{
  801a3e:	f3 0f 1e fb          	endbr32 
  801a42:	55                   	push   %ebp
  801a43:	89 e5                	mov    %esp,%ebp
  801a45:	53                   	push   %ebx
  801a46:	83 ec 04             	sub    $0x4,%esp
  801a49:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  801a4c:	8b 45 08             	mov    0x8(%ebp),%eax
  801a4f:	8b 40 0c             	mov    0xc(%eax),%eax
  801a52:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  801a57:	ba 00 00 00 00       	mov    $0x0,%edx
  801a5c:	b8 05 00 00 00       	mov    $0x5,%eax
  801a61:	e8 37 ff ff ff       	call   80199d <fsipc>
  801a66:	85 c0                	test   %eax,%eax
  801a68:	78 2c                	js     801a96 <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  801a6a:	83 ec 08             	sub    $0x8,%esp
  801a6d:	68 00 50 80 00       	push   $0x805000
  801a72:	53                   	push   %ebx
  801a73:	e8 ac ee ff ff       	call   800924 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  801a78:	a1 80 50 80 00       	mov    0x805080,%eax
  801a7d:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  801a83:	a1 84 50 80 00       	mov    0x805084,%eax
  801a88:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  801a8e:	83 c4 10             	add    $0x10,%esp
  801a91:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801a96:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801a99:	c9                   	leave  
  801a9a:	c3                   	ret    

00801a9b <devfile_write>:
{
  801a9b:	f3 0f 1e fb          	endbr32 
  801a9f:	55                   	push   %ebp
  801aa0:	89 e5                	mov    %esp,%ebp
  801aa2:	83 ec 0c             	sub    $0xc,%esp
  801aa5:	8b 45 10             	mov    0x10(%ebp),%eax
  801aa8:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801aad:	ba f8 0f 00 00       	mov    $0xff8,%edx
  801ab2:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  801ab5:	8b 55 08             	mov    0x8(%ebp),%edx
  801ab8:	8b 52 0c             	mov    0xc(%edx),%edx
  801abb:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  801ac1:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  801ac6:	50                   	push   %eax
  801ac7:	ff 75 0c             	pushl  0xc(%ebp)
  801aca:	68 08 50 80 00       	push   $0x805008
  801acf:	e8 06 f0 ff ff       	call   800ada <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  801ad4:	ba 00 00 00 00       	mov    $0x0,%edx
  801ad9:	b8 04 00 00 00       	mov    $0x4,%eax
  801ade:	e8 ba fe ff ff       	call   80199d <fsipc>
  801ae3:	c9                   	leave  
  801ae4:	c3                   	ret    

00801ae5 <devfile_read>:
{
  801ae5:	f3 0f 1e fb          	endbr32 
  801ae9:	55                   	push   %ebp
  801aea:	89 e5                	mov    %esp,%ebp
  801aec:	56                   	push   %esi
  801aed:	53                   	push   %ebx
  801aee:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  801af1:	8b 45 08             	mov    0x8(%ebp),%eax
  801af4:	8b 40 0c             	mov    0xc(%eax),%eax
  801af7:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801afc:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  801b02:	ba 00 00 00 00       	mov    $0x0,%edx
  801b07:	b8 03 00 00 00       	mov    $0x3,%eax
  801b0c:	e8 8c fe ff ff       	call   80199d <fsipc>
  801b11:	89 c3                	mov    %eax,%ebx
  801b13:	85 c0                	test   %eax,%eax
  801b15:	78 1f                	js     801b36 <devfile_read+0x51>
	assert(r <= n);
  801b17:	39 f0                	cmp    %esi,%eax
  801b19:	77 24                	ja     801b3f <devfile_read+0x5a>
	assert(r <= PGSIZE);
  801b1b:	3d 00 10 00 00       	cmp    $0x1000,%eax
  801b20:	7f 33                	jg     801b55 <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  801b22:	83 ec 04             	sub    $0x4,%esp
  801b25:	50                   	push   %eax
  801b26:	68 00 50 80 00       	push   $0x805000
  801b2b:	ff 75 0c             	pushl  0xc(%ebp)
  801b2e:	e8 a7 ef ff ff       	call   800ada <memmove>
	return r;
  801b33:	83 c4 10             	add    $0x10,%esp
}
  801b36:	89 d8                	mov    %ebx,%eax
  801b38:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801b3b:	5b                   	pop    %ebx
  801b3c:	5e                   	pop    %esi
  801b3d:	5d                   	pop    %ebp
  801b3e:	c3                   	ret    
	assert(r <= n);
  801b3f:	68 a8 2a 80 00       	push   $0x802aa8
  801b44:	68 af 2a 80 00       	push   $0x802aaf
  801b49:	6a 7c                	push   $0x7c
  801b4b:	68 c4 2a 80 00       	push   $0x802ac4
  801b50:	e8 0f e7 ff ff       	call   800264 <_panic>
	assert(r <= PGSIZE);
  801b55:	68 cf 2a 80 00       	push   $0x802acf
  801b5a:	68 af 2a 80 00       	push   $0x802aaf
  801b5f:	6a 7d                	push   $0x7d
  801b61:	68 c4 2a 80 00       	push   $0x802ac4
  801b66:	e8 f9 e6 ff ff       	call   800264 <_panic>

00801b6b <open>:
{
  801b6b:	f3 0f 1e fb          	endbr32 
  801b6f:	55                   	push   %ebp
  801b70:	89 e5                	mov    %esp,%ebp
  801b72:	56                   	push   %esi
  801b73:	53                   	push   %ebx
  801b74:	83 ec 1c             	sub    $0x1c,%esp
  801b77:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801b7a:	56                   	push   %esi
  801b7b:	e8 61 ed ff ff       	call   8008e1 <strlen>
  801b80:	83 c4 10             	add    $0x10,%esp
  801b83:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  801b88:	7f 6c                	jg     801bf6 <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801b8a:	83 ec 0c             	sub    $0xc,%esp
  801b8d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801b90:	50                   	push   %eax
  801b91:	e8 67 f8 ff ff       	call   8013fd <fd_alloc>
  801b96:	89 c3                	mov    %eax,%ebx
  801b98:	83 c4 10             	add    $0x10,%esp
  801b9b:	85 c0                	test   %eax,%eax
  801b9d:	78 3c                	js     801bdb <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801b9f:	83 ec 08             	sub    $0x8,%esp
  801ba2:	56                   	push   %esi
  801ba3:	68 00 50 80 00       	push   $0x805000
  801ba8:	e8 77 ed ff ff       	call   800924 <strcpy>
	fsipcbuf.open.req_omode = mode;
  801bad:	8b 45 0c             	mov    0xc(%ebp),%eax
  801bb0:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  801bb5:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801bb8:	b8 01 00 00 00       	mov    $0x1,%eax
  801bbd:	e8 db fd ff ff       	call   80199d <fsipc>
  801bc2:	89 c3                	mov    %eax,%ebx
  801bc4:	83 c4 10             	add    $0x10,%esp
  801bc7:	85 c0                	test   %eax,%eax
  801bc9:	78 19                	js     801be4 <open+0x79>
	return fd2num(fd);
  801bcb:	83 ec 0c             	sub    $0xc,%esp
  801bce:	ff 75 f4             	pushl  -0xc(%ebp)
  801bd1:	e8 f8 f7 ff ff       	call   8013ce <fd2num>
  801bd6:	89 c3                	mov    %eax,%ebx
  801bd8:	83 c4 10             	add    $0x10,%esp
}
  801bdb:	89 d8                	mov    %ebx,%eax
  801bdd:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801be0:	5b                   	pop    %ebx
  801be1:	5e                   	pop    %esi
  801be2:	5d                   	pop    %ebp
  801be3:	c3                   	ret    
		fd_close(fd, 0);
  801be4:	83 ec 08             	sub    $0x8,%esp
  801be7:	6a 00                	push   $0x0
  801be9:	ff 75 f4             	pushl  -0xc(%ebp)
  801bec:	e8 10 f9 ff ff       	call   801501 <fd_close>
		return r;
  801bf1:	83 c4 10             	add    $0x10,%esp
  801bf4:	eb e5                	jmp    801bdb <open+0x70>
		return -E_BAD_PATH;
  801bf6:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801bfb:	eb de                	jmp    801bdb <open+0x70>

00801bfd <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801bfd:	f3 0f 1e fb          	endbr32 
  801c01:	55                   	push   %ebp
  801c02:	89 e5                	mov    %esp,%ebp
  801c04:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801c07:	ba 00 00 00 00       	mov    $0x0,%edx
  801c0c:	b8 08 00 00 00       	mov    $0x8,%eax
  801c11:	e8 87 fd ff ff       	call   80199d <fsipc>
}
  801c16:	c9                   	leave  
  801c17:	c3                   	ret    

00801c18 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  801c18:	f3 0f 1e fb          	endbr32 
  801c1c:	55                   	push   %ebp
  801c1d:	89 e5                	mov    %esp,%ebp
  801c1f:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  801c22:	89 c2                	mov    %eax,%edx
  801c24:	c1 ea 16             	shr    $0x16,%edx
  801c27:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  801c2e:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  801c33:	f6 c1 01             	test   $0x1,%cl
  801c36:	74 1c                	je     801c54 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  801c38:	c1 e8 0c             	shr    $0xc,%eax
  801c3b:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  801c42:	a8 01                	test   $0x1,%al
  801c44:	74 0e                	je     801c54 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  801c46:	c1 e8 0c             	shr    $0xc,%eax
  801c49:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  801c50:	ef 
  801c51:	0f b7 d2             	movzwl %dx,%edx
}
  801c54:	89 d0                	mov    %edx,%eax
  801c56:	5d                   	pop    %ebp
  801c57:	c3                   	ret    

00801c58 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801c58:	f3 0f 1e fb          	endbr32 
  801c5c:	55                   	push   %ebp
  801c5d:	89 e5                	mov    %esp,%ebp
  801c5f:	56                   	push   %esi
  801c60:	53                   	push   %ebx
  801c61:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801c64:	83 ec 0c             	sub    $0xc,%esp
  801c67:	ff 75 08             	pushl  0x8(%ebp)
  801c6a:	e8 73 f7 ff ff       	call   8013e2 <fd2data>
  801c6f:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801c71:	83 c4 08             	add    $0x8,%esp
  801c74:	68 db 2a 80 00       	push   $0x802adb
  801c79:	53                   	push   %ebx
  801c7a:	e8 a5 ec ff ff       	call   800924 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801c7f:	8b 46 04             	mov    0x4(%esi),%eax
  801c82:	2b 06                	sub    (%esi),%eax
  801c84:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801c8a:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801c91:	00 00 00 
	stat->st_dev = &devpipe;
  801c94:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  801c9b:	30 80 00 
	return 0;
}
  801c9e:	b8 00 00 00 00       	mov    $0x0,%eax
  801ca3:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801ca6:	5b                   	pop    %ebx
  801ca7:	5e                   	pop    %esi
  801ca8:	5d                   	pop    %ebp
  801ca9:	c3                   	ret    

00801caa <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801caa:	f3 0f 1e fb          	endbr32 
  801cae:	55                   	push   %ebp
  801caf:	89 e5                	mov    %esp,%ebp
  801cb1:	53                   	push   %ebx
  801cb2:	83 ec 0c             	sub    $0xc,%esp
  801cb5:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801cb8:	53                   	push   %ebx
  801cb9:	6a 00                	push   $0x0
  801cbb:	e8 33 f1 ff ff       	call   800df3 <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801cc0:	89 1c 24             	mov    %ebx,(%esp)
  801cc3:	e8 1a f7 ff ff       	call   8013e2 <fd2data>
  801cc8:	83 c4 08             	add    $0x8,%esp
  801ccb:	50                   	push   %eax
  801ccc:	6a 00                	push   $0x0
  801cce:	e8 20 f1 ff ff       	call   800df3 <sys_page_unmap>
}
  801cd3:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801cd6:	c9                   	leave  
  801cd7:	c3                   	ret    

00801cd8 <_pipeisclosed>:
{
  801cd8:	55                   	push   %ebp
  801cd9:	89 e5                	mov    %esp,%ebp
  801cdb:	57                   	push   %edi
  801cdc:	56                   	push   %esi
  801cdd:	53                   	push   %ebx
  801cde:	83 ec 1c             	sub    $0x1c,%esp
  801ce1:	89 c7                	mov    %eax,%edi
  801ce3:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801ce5:	a1 04 40 80 00       	mov    0x804004,%eax
  801cea:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801ced:	83 ec 0c             	sub    $0xc,%esp
  801cf0:	57                   	push   %edi
  801cf1:	e8 22 ff ff ff       	call   801c18 <pageref>
  801cf6:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801cf9:	89 34 24             	mov    %esi,(%esp)
  801cfc:	e8 17 ff ff ff       	call   801c18 <pageref>
		nn = thisenv->env_runs;
  801d01:	8b 15 04 40 80 00    	mov    0x804004,%edx
  801d07:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801d0a:	83 c4 10             	add    $0x10,%esp
  801d0d:	39 cb                	cmp    %ecx,%ebx
  801d0f:	74 1b                	je     801d2c <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801d11:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801d14:	75 cf                	jne    801ce5 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801d16:	8b 42 58             	mov    0x58(%edx),%eax
  801d19:	6a 01                	push   $0x1
  801d1b:	50                   	push   %eax
  801d1c:	53                   	push   %ebx
  801d1d:	68 e2 2a 80 00       	push   $0x802ae2
  801d22:	e8 24 e6 ff ff       	call   80034b <cprintf>
  801d27:	83 c4 10             	add    $0x10,%esp
  801d2a:	eb b9                	jmp    801ce5 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801d2c:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801d2f:	0f 94 c0             	sete   %al
  801d32:	0f b6 c0             	movzbl %al,%eax
}
  801d35:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801d38:	5b                   	pop    %ebx
  801d39:	5e                   	pop    %esi
  801d3a:	5f                   	pop    %edi
  801d3b:	5d                   	pop    %ebp
  801d3c:	c3                   	ret    

00801d3d <devpipe_write>:
{
  801d3d:	f3 0f 1e fb          	endbr32 
  801d41:	55                   	push   %ebp
  801d42:	89 e5                	mov    %esp,%ebp
  801d44:	57                   	push   %edi
  801d45:	56                   	push   %esi
  801d46:	53                   	push   %ebx
  801d47:	83 ec 28             	sub    $0x28,%esp
  801d4a:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801d4d:	56                   	push   %esi
  801d4e:	e8 8f f6 ff ff       	call   8013e2 <fd2data>
  801d53:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801d55:	83 c4 10             	add    $0x10,%esp
  801d58:	bf 00 00 00 00       	mov    $0x0,%edi
  801d5d:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801d60:	74 4f                	je     801db1 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801d62:	8b 43 04             	mov    0x4(%ebx),%eax
  801d65:	8b 0b                	mov    (%ebx),%ecx
  801d67:	8d 51 20             	lea    0x20(%ecx),%edx
  801d6a:	39 d0                	cmp    %edx,%eax
  801d6c:	72 14                	jb     801d82 <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801d6e:	89 da                	mov    %ebx,%edx
  801d70:	89 f0                	mov    %esi,%eax
  801d72:	e8 61 ff ff ff       	call   801cd8 <_pipeisclosed>
  801d77:	85 c0                	test   %eax,%eax
  801d79:	75 3b                	jne    801db6 <devpipe_write+0x79>
			sys_yield();
  801d7b:	e8 c3 ef ff ff       	call   800d43 <sys_yield>
  801d80:	eb e0                	jmp    801d62 <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801d82:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801d85:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801d89:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801d8c:	89 c2                	mov    %eax,%edx
  801d8e:	c1 fa 1f             	sar    $0x1f,%edx
  801d91:	89 d1                	mov    %edx,%ecx
  801d93:	c1 e9 1b             	shr    $0x1b,%ecx
  801d96:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801d99:	83 e2 1f             	and    $0x1f,%edx
  801d9c:	29 ca                	sub    %ecx,%edx
  801d9e:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801da2:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801da6:	83 c0 01             	add    $0x1,%eax
  801da9:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801dac:	83 c7 01             	add    $0x1,%edi
  801daf:	eb ac                	jmp    801d5d <devpipe_write+0x20>
	return i;
  801db1:	8b 45 10             	mov    0x10(%ebp),%eax
  801db4:	eb 05                	jmp    801dbb <devpipe_write+0x7e>
				return 0;
  801db6:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801dbb:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801dbe:	5b                   	pop    %ebx
  801dbf:	5e                   	pop    %esi
  801dc0:	5f                   	pop    %edi
  801dc1:	5d                   	pop    %ebp
  801dc2:	c3                   	ret    

00801dc3 <devpipe_read>:
{
  801dc3:	f3 0f 1e fb          	endbr32 
  801dc7:	55                   	push   %ebp
  801dc8:	89 e5                	mov    %esp,%ebp
  801dca:	57                   	push   %edi
  801dcb:	56                   	push   %esi
  801dcc:	53                   	push   %ebx
  801dcd:	83 ec 18             	sub    $0x18,%esp
  801dd0:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801dd3:	57                   	push   %edi
  801dd4:	e8 09 f6 ff ff       	call   8013e2 <fd2data>
  801dd9:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801ddb:	83 c4 10             	add    $0x10,%esp
  801dde:	be 00 00 00 00       	mov    $0x0,%esi
  801de3:	3b 75 10             	cmp    0x10(%ebp),%esi
  801de6:	75 14                	jne    801dfc <devpipe_read+0x39>
	return i;
  801de8:	8b 45 10             	mov    0x10(%ebp),%eax
  801deb:	eb 02                	jmp    801def <devpipe_read+0x2c>
				return i;
  801ded:	89 f0                	mov    %esi,%eax
}
  801def:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801df2:	5b                   	pop    %ebx
  801df3:	5e                   	pop    %esi
  801df4:	5f                   	pop    %edi
  801df5:	5d                   	pop    %ebp
  801df6:	c3                   	ret    
			sys_yield();
  801df7:	e8 47 ef ff ff       	call   800d43 <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801dfc:	8b 03                	mov    (%ebx),%eax
  801dfe:	3b 43 04             	cmp    0x4(%ebx),%eax
  801e01:	75 18                	jne    801e1b <devpipe_read+0x58>
			if (i > 0)
  801e03:	85 f6                	test   %esi,%esi
  801e05:	75 e6                	jne    801ded <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801e07:	89 da                	mov    %ebx,%edx
  801e09:	89 f8                	mov    %edi,%eax
  801e0b:	e8 c8 fe ff ff       	call   801cd8 <_pipeisclosed>
  801e10:	85 c0                	test   %eax,%eax
  801e12:	74 e3                	je     801df7 <devpipe_read+0x34>
				return 0;
  801e14:	b8 00 00 00 00       	mov    $0x0,%eax
  801e19:	eb d4                	jmp    801def <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801e1b:	99                   	cltd   
  801e1c:	c1 ea 1b             	shr    $0x1b,%edx
  801e1f:	01 d0                	add    %edx,%eax
  801e21:	83 e0 1f             	and    $0x1f,%eax
  801e24:	29 d0                	sub    %edx,%eax
  801e26:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801e2b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801e2e:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801e31:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801e34:	83 c6 01             	add    $0x1,%esi
  801e37:	eb aa                	jmp    801de3 <devpipe_read+0x20>

00801e39 <pipe>:
{
  801e39:	f3 0f 1e fb          	endbr32 
  801e3d:	55                   	push   %ebp
  801e3e:	89 e5                	mov    %esp,%ebp
  801e40:	56                   	push   %esi
  801e41:	53                   	push   %ebx
  801e42:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801e45:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e48:	50                   	push   %eax
  801e49:	e8 af f5 ff ff       	call   8013fd <fd_alloc>
  801e4e:	89 c3                	mov    %eax,%ebx
  801e50:	83 c4 10             	add    $0x10,%esp
  801e53:	85 c0                	test   %eax,%eax
  801e55:	0f 88 23 01 00 00    	js     801f7e <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801e5b:	83 ec 04             	sub    $0x4,%esp
  801e5e:	68 07 04 00 00       	push   $0x407
  801e63:	ff 75 f4             	pushl  -0xc(%ebp)
  801e66:	6a 00                	push   $0x0
  801e68:	e8 f9 ee ff ff       	call   800d66 <sys_page_alloc>
  801e6d:	89 c3                	mov    %eax,%ebx
  801e6f:	83 c4 10             	add    $0x10,%esp
  801e72:	85 c0                	test   %eax,%eax
  801e74:	0f 88 04 01 00 00    	js     801f7e <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801e7a:	83 ec 0c             	sub    $0xc,%esp
  801e7d:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801e80:	50                   	push   %eax
  801e81:	e8 77 f5 ff ff       	call   8013fd <fd_alloc>
  801e86:	89 c3                	mov    %eax,%ebx
  801e88:	83 c4 10             	add    $0x10,%esp
  801e8b:	85 c0                	test   %eax,%eax
  801e8d:	0f 88 db 00 00 00    	js     801f6e <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801e93:	83 ec 04             	sub    $0x4,%esp
  801e96:	68 07 04 00 00       	push   $0x407
  801e9b:	ff 75 f0             	pushl  -0x10(%ebp)
  801e9e:	6a 00                	push   $0x0
  801ea0:	e8 c1 ee ff ff       	call   800d66 <sys_page_alloc>
  801ea5:	89 c3                	mov    %eax,%ebx
  801ea7:	83 c4 10             	add    $0x10,%esp
  801eaa:	85 c0                	test   %eax,%eax
  801eac:	0f 88 bc 00 00 00    	js     801f6e <pipe+0x135>
	va = fd2data(fd0);
  801eb2:	83 ec 0c             	sub    $0xc,%esp
  801eb5:	ff 75 f4             	pushl  -0xc(%ebp)
  801eb8:	e8 25 f5 ff ff       	call   8013e2 <fd2data>
  801ebd:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ebf:	83 c4 0c             	add    $0xc,%esp
  801ec2:	68 07 04 00 00       	push   $0x407
  801ec7:	50                   	push   %eax
  801ec8:	6a 00                	push   $0x0
  801eca:	e8 97 ee ff ff       	call   800d66 <sys_page_alloc>
  801ecf:	89 c3                	mov    %eax,%ebx
  801ed1:	83 c4 10             	add    $0x10,%esp
  801ed4:	85 c0                	test   %eax,%eax
  801ed6:	0f 88 82 00 00 00    	js     801f5e <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801edc:	83 ec 0c             	sub    $0xc,%esp
  801edf:	ff 75 f0             	pushl  -0x10(%ebp)
  801ee2:	e8 fb f4 ff ff       	call   8013e2 <fd2data>
  801ee7:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801eee:	50                   	push   %eax
  801eef:	6a 00                	push   $0x0
  801ef1:	56                   	push   %esi
  801ef2:	6a 00                	push   $0x0
  801ef4:	e8 b4 ee ff ff       	call   800dad <sys_page_map>
  801ef9:	89 c3                	mov    %eax,%ebx
  801efb:	83 c4 20             	add    $0x20,%esp
  801efe:	85 c0                	test   %eax,%eax
  801f00:	78 4e                	js     801f50 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801f02:	a1 20 30 80 00       	mov    0x803020,%eax
  801f07:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801f0a:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801f0c:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801f0f:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801f16:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801f19:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801f1b:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801f1e:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801f25:	83 ec 0c             	sub    $0xc,%esp
  801f28:	ff 75 f4             	pushl  -0xc(%ebp)
  801f2b:	e8 9e f4 ff ff       	call   8013ce <fd2num>
  801f30:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801f33:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801f35:	83 c4 04             	add    $0x4,%esp
  801f38:	ff 75 f0             	pushl  -0x10(%ebp)
  801f3b:	e8 8e f4 ff ff       	call   8013ce <fd2num>
  801f40:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801f43:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801f46:	83 c4 10             	add    $0x10,%esp
  801f49:	bb 00 00 00 00       	mov    $0x0,%ebx
  801f4e:	eb 2e                	jmp    801f7e <pipe+0x145>
	sys_page_unmap(0, va);
  801f50:	83 ec 08             	sub    $0x8,%esp
  801f53:	56                   	push   %esi
  801f54:	6a 00                	push   $0x0
  801f56:	e8 98 ee ff ff       	call   800df3 <sys_page_unmap>
  801f5b:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801f5e:	83 ec 08             	sub    $0x8,%esp
  801f61:	ff 75 f0             	pushl  -0x10(%ebp)
  801f64:	6a 00                	push   $0x0
  801f66:	e8 88 ee ff ff       	call   800df3 <sys_page_unmap>
  801f6b:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801f6e:	83 ec 08             	sub    $0x8,%esp
  801f71:	ff 75 f4             	pushl  -0xc(%ebp)
  801f74:	6a 00                	push   $0x0
  801f76:	e8 78 ee ff ff       	call   800df3 <sys_page_unmap>
  801f7b:	83 c4 10             	add    $0x10,%esp
}
  801f7e:	89 d8                	mov    %ebx,%eax
  801f80:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801f83:	5b                   	pop    %ebx
  801f84:	5e                   	pop    %esi
  801f85:	5d                   	pop    %ebp
  801f86:	c3                   	ret    

00801f87 <pipeisclosed>:
{
  801f87:	f3 0f 1e fb          	endbr32 
  801f8b:	55                   	push   %ebp
  801f8c:	89 e5                	mov    %esp,%ebp
  801f8e:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801f91:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801f94:	50                   	push   %eax
  801f95:	ff 75 08             	pushl  0x8(%ebp)
  801f98:	e8 b6 f4 ff ff       	call   801453 <fd_lookup>
  801f9d:	83 c4 10             	add    $0x10,%esp
  801fa0:	85 c0                	test   %eax,%eax
  801fa2:	78 18                	js     801fbc <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801fa4:	83 ec 0c             	sub    $0xc,%esp
  801fa7:	ff 75 f4             	pushl  -0xc(%ebp)
  801faa:	e8 33 f4 ff ff       	call   8013e2 <fd2data>
  801faf:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801fb1:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801fb4:	e8 1f fd ff ff       	call   801cd8 <_pipeisclosed>
  801fb9:	83 c4 10             	add    $0x10,%esp
}
  801fbc:	c9                   	leave  
  801fbd:	c3                   	ret    

00801fbe <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801fbe:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801fc2:	b8 00 00 00 00       	mov    $0x0,%eax
  801fc7:	c3                   	ret    

00801fc8 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801fc8:	f3 0f 1e fb          	endbr32 
  801fcc:	55                   	push   %ebp
  801fcd:	89 e5                	mov    %esp,%ebp
  801fcf:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801fd2:	68 fa 2a 80 00       	push   $0x802afa
  801fd7:	ff 75 0c             	pushl  0xc(%ebp)
  801fda:	e8 45 e9 ff ff       	call   800924 <strcpy>
	return 0;
}
  801fdf:	b8 00 00 00 00       	mov    $0x0,%eax
  801fe4:	c9                   	leave  
  801fe5:	c3                   	ret    

00801fe6 <devcons_write>:
{
  801fe6:	f3 0f 1e fb          	endbr32 
  801fea:	55                   	push   %ebp
  801feb:	89 e5                	mov    %esp,%ebp
  801fed:	57                   	push   %edi
  801fee:	56                   	push   %esi
  801fef:	53                   	push   %ebx
  801ff0:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801ff6:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801ffb:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  802001:	3b 75 10             	cmp    0x10(%ebp),%esi
  802004:	73 31                	jae    802037 <devcons_write+0x51>
		m = n - tot;
  802006:	8b 5d 10             	mov    0x10(%ebp),%ebx
  802009:	29 f3                	sub    %esi,%ebx
  80200b:	83 fb 7f             	cmp    $0x7f,%ebx
  80200e:	b8 7f 00 00 00       	mov    $0x7f,%eax
  802013:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  802016:	83 ec 04             	sub    $0x4,%esp
  802019:	53                   	push   %ebx
  80201a:	89 f0                	mov    %esi,%eax
  80201c:	03 45 0c             	add    0xc(%ebp),%eax
  80201f:	50                   	push   %eax
  802020:	57                   	push   %edi
  802021:	e8 b4 ea ff ff       	call   800ada <memmove>
		sys_cputs(buf, m);
  802026:	83 c4 08             	add    $0x8,%esp
  802029:	53                   	push   %ebx
  80202a:	57                   	push   %edi
  80202b:	e8 66 ec ff ff       	call   800c96 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  802030:	01 de                	add    %ebx,%esi
  802032:	83 c4 10             	add    $0x10,%esp
  802035:	eb ca                	jmp    802001 <devcons_write+0x1b>
}
  802037:	89 f0                	mov    %esi,%eax
  802039:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80203c:	5b                   	pop    %ebx
  80203d:	5e                   	pop    %esi
  80203e:	5f                   	pop    %edi
  80203f:	5d                   	pop    %ebp
  802040:	c3                   	ret    

00802041 <devcons_read>:
{
  802041:	f3 0f 1e fb          	endbr32 
  802045:	55                   	push   %ebp
  802046:	89 e5                	mov    %esp,%ebp
  802048:	83 ec 08             	sub    $0x8,%esp
  80204b:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  802050:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  802054:	74 21                	je     802077 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  802056:	e8 5d ec ff ff       	call   800cb8 <sys_cgetc>
  80205b:	85 c0                	test   %eax,%eax
  80205d:	75 07                	jne    802066 <devcons_read+0x25>
		sys_yield();
  80205f:	e8 df ec ff ff       	call   800d43 <sys_yield>
  802064:	eb f0                	jmp    802056 <devcons_read+0x15>
	if (c < 0)
  802066:	78 0f                	js     802077 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  802068:	83 f8 04             	cmp    $0x4,%eax
  80206b:	74 0c                	je     802079 <devcons_read+0x38>
	*(char*)vbuf = c;
  80206d:	8b 55 0c             	mov    0xc(%ebp),%edx
  802070:	88 02                	mov    %al,(%edx)
	return 1;
  802072:	b8 01 00 00 00       	mov    $0x1,%eax
}
  802077:	c9                   	leave  
  802078:	c3                   	ret    
		return 0;
  802079:	b8 00 00 00 00       	mov    $0x0,%eax
  80207e:	eb f7                	jmp    802077 <devcons_read+0x36>

00802080 <cputchar>:
{
  802080:	f3 0f 1e fb          	endbr32 
  802084:	55                   	push   %ebp
  802085:	89 e5                	mov    %esp,%ebp
  802087:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  80208a:	8b 45 08             	mov    0x8(%ebp),%eax
  80208d:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  802090:	6a 01                	push   $0x1
  802092:	8d 45 f7             	lea    -0x9(%ebp),%eax
  802095:	50                   	push   %eax
  802096:	e8 fb eb ff ff       	call   800c96 <sys_cputs>
}
  80209b:	83 c4 10             	add    $0x10,%esp
  80209e:	c9                   	leave  
  80209f:	c3                   	ret    

008020a0 <getchar>:
{
  8020a0:	f3 0f 1e fb          	endbr32 
  8020a4:	55                   	push   %ebp
  8020a5:	89 e5                	mov    %esp,%ebp
  8020a7:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  8020aa:	6a 01                	push   $0x1
  8020ac:	8d 45 f7             	lea    -0x9(%ebp),%eax
  8020af:	50                   	push   %eax
  8020b0:	6a 00                	push   $0x0
  8020b2:	e8 1f f6 ff ff       	call   8016d6 <read>
	if (r < 0)
  8020b7:	83 c4 10             	add    $0x10,%esp
  8020ba:	85 c0                	test   %eax,%eax
  8020bc:	78 06                	js     8020c4 <getchar+0x24>
	if (r < 1)
  8020be:	74 06                	je     8020c6 <getchar+0x26>
	return c;
  8020c0:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  8020c4:	c9                   	leave  
  8020c5:	c3                   	ret    
		return -E_EOF;
  8020c6:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  8020cb:	eb f7                	jmp    8020c4 <getchar+0x24>

008020cd <iscons>:
{
  8020cd:	f3 0f 1e fb          	endbr32 
  8020d1:	55                   	push   %ebp
  8020d2:	89 e5                	mov    %esp,%ebp
  8020d4:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8020d7:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8020da:	50                   	push   %eax
  8020db:	ff 75 08             	pushl  0x8(%ebp)
  8020de:	e8 70 f3 ff ff       	call   801453 <fd_lookup>
  8020e3:	83 c4 10             	add    $0x10,%esp
  8020e6:	85 c0                	test   %eax,%eax
  8020e8:	78 11                	js     8020fb <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  8020ea:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8020ed:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  8020f3:	39 10                	cmp    %edx,(%eax)
  8020f5:	0f 94 c0             	sete   %al
  8020f8:	0f b6 c0             	movzbl %al,%eax
}
  8020fb:	c9                   	leave  
  8020fc:	c3                   	ret    

008020fd <opencons>:
{
  8020fd:	f3 0f 1e fb          	endbr32 
  802101:	55                   	push   %ebp
  802102:	89 e5                	mov    %esp,%ebp
  802104:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  802107:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80210a:	50                   	push   %eax
  80210b:	e8 ed f2 ff ff       	call   8013fd <fd_alloc>
  802110:	83 c4 10             	add    $0x10,%esp
  802113:	85 c0                	test   %eax,%eax
  802115:	78 3a                	js     802151 <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  802117:	83 ec 04             	sub    $0x4,%esp
  80211a:	68 07 04 00 00       	push   $0x407
  80211f:	ff 75 f4             	pushl  -0xc(%ebp)
  802122:	6a 00                	push   $0x0
  802124:	e8 3d ec ff ff       	call   800d66 <sys_page_alloc>
  802129:	83 c4 10             	add    $0x10,%esp
  80212c:	85 c0                	test   %eax,%eax
  80212e:	78 21                	js     802151 <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  802130:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802133:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  802139:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  80213b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80213e:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  802145:	83 ec 0c             	sub    $0xc,%esp
  802148:	50                   	push   %eax
  802149:	e8 80 f2 ff ff       	call   8013ce <fd2num>
  80214e:	83 c4 10             	add    $0x10,%esp
}
  802151:	c9                   	leave  
  802152:	c3                   	ret    

00802153 <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  802153:	f3 0f 1e fb          	endbr32 
  802157:	55                   	push   %ebp
  802158:	89 e5                	mov    %esp,%ebp
  80215a:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  80215d:	83 3d 00 60 80 00 00 	cmpl   $0x0,0x806000
  802164:	74 27                	je     80218d <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  802166:	8b 45 08             	mov    0x8(%ebp),%eax
  802169:	a3 00 60 80 00       	mov    %eax,0x806000
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  80216e:	a1 04 40 80 00       	mov    0x804004,%eax
  802173:	8b 40 48             	mov    0x48(%eax),%eax
  802176:	83 ec 08             	sub    $0x8,%esp
  802179:	68 cd 21 80 00       	push   $0x8021cd
  80217e:	50                   	push   %eax
  80217f:	e8 41 ed ff ff       	call   800ec5 <sys_env_set_pgfault_upcall>
  802184:	83 c4 10             	add    $0x10,%esp
  802187:	85 c0                	test   %eax,%eax
  802189:	78 2e                	js     8021b9 <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  80218b:	c9                   	leave  
  80218c:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  80218d:	83 ec 04             	sub    $0x4,%esp
  802190:	6a 07                	push   $0x7
  802192:	68 00 f0 bf ee       	push   $0xeebff000
  802197:	6a 00                	push   $0x0
  802199:	e8 c8 eb ff ff       	call   800d66 <sys_page_alloc>
  80219e:	83 c4 10             	add    $0x10,%esp
  8021a1:	85 c0                	test   %eax,%eax
  8021a3:	79 c1                	jns    802166 <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  8021a5:	83 ec 04             	sub    $0x4,%esp
  8021a8:	68 08 2b 80 00       	push   $0x802b08
  8021ad:	6a 21                	push   $0x21
  8021af:	68 6a 2b 80 00       	push   $0x802b6a
  8021b4:	e8 ab e0 ff ff       	call   800264 <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  8021b9:	83 ec 04             	sub    $0x4,%esp
  8021bc:	68 34 2b 80 00       	push   $0x802b34
  8021c1:	6a 27                	push   $0x27
  8021c3:	68 6a 2b 80 00       	push   $0x802b6a
  8021c8:	e8 97 e0 ff ff       	call   800264 <_panic>

008021cd <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  8021cd:	54                   	push   %esp
	movl _pgfault_handler, %eax
  8021ce:	a1 00 60 80 00       	mov    0x806000,%eax
	call *%eax
  8021d3:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  8021d5:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  8021d8:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  8021dc:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  8021df:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  8021e3:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  8021e7:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  8021ea:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  8021ed:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  8021ee:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  8021f1:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  8021f2:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  8021f3:	c3                   	ret    
  8021f4:	66 90                	xchg   %ax,%ax
  8021f6:	66 90                	xchg   %ax,%ax
  8021f8:	66 90                	xchg   %ax,%ax
  8021fa:	66 90                	xchg   %ax,%ax
  8021fc:	66 90                	xchg   %ax,%ax
  8021fe:	66 90                	xchg   %ax,%ax

00802200 <__udivdi3>:
  802200:	f3 0f 1e fb          	endbr32 
  802204:	55                   	push   %ebp
  802205:	57                   	push   %edi
  802206:	56                   	push   %esi
  802207:	53                   	push   %ebx
  802208:	83 ec 1c             	sub    $0x1c,%esp
  80220b:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  80220f:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  802213:	8b 74 24 34          	mov    0x34(%esp),%esi
  802217:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  80221b:	85 d2                	test   %edx,%edx
  80221d:	75 19                	jne    802238 <__udivdi3+0x38>
  80221f:	39 f3                	cmp    %esi,%ebx
  802221:	76 4d                	jbe    802270 <__udivdi3+0x70>
  802223:	31 ff                	xor    %edi,%edi
  802225:	89 e8                	mov    %ebp,%eax
  802227:	89 f2                	mov    %esi,%edx
  802229:	f7 f3                	div    %ebx
  80222b:	89 fa                	mov    %edi,%edx
  80222d:	83 c4 1c             	add    $0x1c,%esp
  802230:	5b                   	pop    %ebx
  802231:	5e                   	pop    %esi
  802232:	5f                   	pop    %edi
  802233:	5d                   	pop    %ebp
  802234:	c3                   	ret    
  802235:	8d 76 00             	lea    0x0(%esi),%esi
  802238:	39 f2                	cmp    %esi,%edx
  80223a:	76 14                	jbe    802250 <__udivdi3+0x50>
  80223c:	31 ff                	xor    %edi,%edi
  80223e:	31 c0                	xor    %eax,%eax
  802240:	89 fa                	mov    %edi,%edx
  802242:	83 c4 1c             	add    $0x1c,%esp
  802245:	5b                   	pop    %ebx
  802246:	5e                   	pop    %esi
  802247:	5f                   	pop    %edi
  802248:	5d                   	pop    %ebp
  802249:	c3                   	ret    
  80224a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802250:	0f bd fa             	bsr    %edx,%edi
  802253:	83 f7 1f             	xor    $0x1f,%edi
  802256:	75 48                	jne    8022a0 <__udivdi3+0xa0>
  802258:	39 f2                	cmp    %esi,%edx
  80225a:	72 06                	jb     802262 <__udivdi3+0x62>
  80225c:	31 c0                	xor    %eax,%eax
  80225e:	39 eb                	cmp    %ebp,%ebx
  802260:	77 de                	ja     802240 <__udivdi3+0x40>
  802262:	b8 01 00 00 00       	mov    $0x1,%eax
  802267:	eb d7                	jmp    802240 <__udivdi3+0x40>
  802269:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802270:	89 d9                	mov    %ebx,%ecx
  802272:	85 db                	test   %ebx,%ebx
  802274:	75 0b                	jne    802281 <__udivdi3+0x81>
  802276:	b8 01 00 00 00       	mov    $0x1,%eax
  80227b:	31 d2                	xor    %edx,%edx
  80227d:	f7 f3                	div    %ebx
  80227f:	89 c1                	mov    %eax,%ecx
  802281:	31 d2                	xor    %edx,%edx
  802283:	89 f0                	mov    %esi,%eax
  802285:	f7 f1                	div    %ecx
  802287:	89 c6                	mov    %eax,%esi
  802289:	89 e8                	mov    %ebp,%eax
  80228b:	89 f7                	mov    %esi,%edi
  80228d:	f7 f1                	div    %ecx
  80228f:	89 fa                	mov    %edi,%edx
  802291:	83 c4 1c             	add    $0x1c,%esp
  802294:	5b                   	pop    %ebx
  802295:	5e                   	pop    %esi
  802296:	5f                   	pop    %edi
  802297:	5d                   	pop    %ebp
  802298:	c3                   	ret    
  802299:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8022a0:	89 f9                	mov    %edi,%ecx
  8022a2:	b8 20 00 00 00       	mov    $0x20,%eax
  8022a7:	29 f8                	sub    %edi,%eax
  8022a9:	d3 e2                	shl    %cl,%edx
  8022ab:	89 54 24 08          	mov    %edx,0x8(%esp)
  8022af:	89 c1                	mov    %eax,%ecx
  8022b1:	89 da                	mov    %ebx,%edx
  8022b3:	d3 ea                	shr    %cl,%edx
  8022b5:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8022b9:	09 d1                	or     %edx,%ecx
  8022bb:	89 f2                	mov    %esi,%edx
  8022bd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8022c1:	89 f9                	mov    %edi,%ecx
  8022c3:	d3 e3                	shl    %cl,%ebx
  8022c5:	89 c1                	mov    %eax,%ecx
  8022c7:	d3 ea                	shr    %cl,%edx
  8022c9:	89 f9                	mov    %edi,%ecx
  8022cb:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  8022cf:	89 eb                	mov    %ebp,%ebx
  8022d1:	d3 e6                	shl    %cl,%esi
  8022d3:	89 c1                	mov    %eax,%ecx
  8022d5:	d3 eb                	shr    %cl,%ebx
  8022d7:	09 de                	or     %ebx,%esi
  8022d9:	89 f0                	mov    %esi,%eax
  8022db:	f7 74 24 08          	divl   0x8(%esp)
  8022df:	89 d6                	mov    %edx,%esi
  8022e1:	89 c3                	mov    %eax,%ebx
  8022e3:	f7 64 24 0c          	mull   0xc(%esp)
  8022e7:	39 d6                	cmp    %edx,%esi
  8022e9:	72 15                	jb     802300 <__udivdi3+0x100>
  8022eb:	89 f9                	mov    %edi,%ecx
  8022ed:	d3 e5                	shl    %cl,%ebp
  8022ef:	39 c5                	cmp    %eax,%ebp
  8022f1:	73 04                	jae    8022f7 <__udivdi3+0xf7>
  8022f3:	39 d6                	cmp    %edx,%esi
  8022f5:	74 09                	je     802300 <__udivdi3+0x100>
  8022f7:	89 d8                	mov    %ebx,%eax
  8022f9:	31 ff                	xor    %edi,%edi
  8022fb:	e9 40 ff ff ff       	jmp    802240 <__udivdi3+0x40>
  802300:	8d 43 ff             	lea    -0x1(%ebx),%eax
  802303:	31 ff                	xor    %edi,%edi
  802305:	e9 36 ff ff ff       	jmp    802240 <__udivdi3+0x40>
  80230a:	66 90                	xchg   %ax,%ax
  80230c:	66 90                	xchg   %ax,%ax
  80230e:	66 90                	xchg   %ax,%ax

00802310 <__umoddi3>:
  802310:	f3 0f 1e fb          	endbr32 
  802314:	55                   	push   %ebp
  802315:	57                   	push   %edi
  802316:	56                   	push   %esi
  802317:	53                   	push   %ebx
  802318:	83 ec 1c             	sub    $0x1c,%esp
  80231b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  80231f:	8b 74 24 30          	mov    0x30(%esp),%esi
  802323:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  802327:	8b 7c 24 38          	mov    0x38(%esp),%edi
  80232b:	85 c0                	test   %eax,%eax
  80232d:	75 19                	jne    802348 <__umoddi3+0x38>
  80232f:	39 df                	cmp    %ebx,%edi
  802331:	76 5d                	jbe    802390 <__umoddi3+0x80>
  802333:	89 f0                	mov    %esi,%eax
  802335:	89 da                	mov    %ebx,%edx
  802337:	f7 f7                	div    %edi
  802339:	89 d0                	mov    %edx,%eax
  80233b:	31 d2                	xor    %edx,%edx
  80233d:	83 c4 1c             	add    $0x1c,%esp
  802340:	5b                   	pop    %ebx
  802341:	5e                   	pop    %esi
  802342:	5f                   	pop    %edi
  802343:	5d                   	pop    %ebp
  802344:	c3                   	ret    
  802345:	8d 76 00             	lea    0x0(%esi),%esi
  802348:	89 f2                	mov    %esi,%edx
  80234a:	39 d8                	cmp    %ebx,%eax
  80234c:	76 12                	jbe    802360 <__umoddi3+0x50>
  80234e:	89 f0                	mov    %esi,%eax
  802350:	89 da                	mov    %ebx,%edx
  802352:	83 c4 1c             	add    $0x1c,%esp
  802355:	5b                   	pop    %ebx
  802356:	5e                   	pop    %esi
  802357:	5f                   	pop    %edi
  802358:	5d                   	pop    %ebp
  802359:	c3                   	ret    
  80235a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802360:	0f bd e8             	bsr    %eax,%ebp
  802363:	83 f5 1f             	xor    $0x1f,%ebp
  802366:	75 50                	jne    8023b8 <__umoddi3+0xa8>
  802368:	39 d8                	cmp    %ebx,%eax
  80236a:	0f 82 e0 00 00 00    	jb     802450 <__umoddi3+0x140>
  802370:	89 d9                	mov    %ebx,%ecx
  802372:	39 f7                	cmp    %esi,%edi
  802374:	0f 86 d6 00 00 00    	jbe    802450 <__umoddi3+0x140>
  80237a:	89 d0                	mov    %edx,%eax
  80237c:	89 ca                	mov    %ecx,%edx
  80237e:	83 c4 1c             	add    $0x1c,%esp
  802381:	5b                   	pop    %ebx
  802382:	5e                   	pop    %esi
  802383:	5f                   	pop    %edi
  802384:	5d                   	pop    %ebp
  802385:	c3                   	ret    
  802386:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80238d:	8d 76 00             	lea    0x0(%esi),%esi
  802390:	89 fd                	mov    %edi,%ebp
  802392:	85 ff                	test   %edi,%edi
  802394:	75 0b                	jne    8023a1 <__umoddi3+0x91>
  802396:	b8 01 00 00 00       	mov    $0x1,%eax
  80239b:	31 d2                	xor    %edx,%edx
  80239d:	f7 f7                	div    %edi
  80239f:	89 c5                	mov    %eax,%ebp
  8023a1:	89 d8                	mov    %ebx,%eax
  8023a3:	31 d2                	xor    %edx,%edx
  8023a5:	f7 f5                	div    %ebp
  8023a7:	89 f0                	mov    %esi,%eax
  8023a9:	f7 f5                	div    %ebp
  8023ab:	89 d0                	mov    %edx,%eax
  8023ad:	31 d2                	xor    %edx,%edx
  8023af:	eb 8c                	jmp    80233d <__umoddi3+0x2d>
  8023b1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8023b8:	89 e9                	mov    %ebp,%ecx
  8023ba:	ba 20 00 00 00       	mov    $0x20,%edx
  8023bf:	29 ea                	sub    %ebp,%edx
  8023c1:	d3 e0                	shl    %cl,%eax
  8023c3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8023c7:	89 d1                	mov    %edx,%ecx
  8023c9:	89 f8                	mov    %edi,%eax
  8023cb:	d3 e8                	shr    %cl,%eax
  8023cd:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8023d1:	89 54 24 04          	mov    %edx,0x4(%esp)
  8023d5:	8b 54 24 04          	mov    0x4(%esp),%edx
  8023d9:	09 c1                	or     %eax,%ecx
  8023db:	89 d8                	mov    %ebx,%eax
  8023dd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8023e1:	89 e9                	mov    %ebp,%ecx
  8023e3:	d3 e7                	shl    %cl,%edi
  8023e5:	89 d1                	mov    %edx,%ecx
  8023e7:	d3 e8                	shr    %cl,%eax
  8023e9:	89 e9                	mov    %ebp,%ecx
  8023eb:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  8023ef:	d3 e3                	shl    %cl,%ebx
  8023f1:	89 c7                	mov    %eax,%edi
  8023f3:	89 d1                	mov    %edx,%ecx
  8023f5:	89 f0                	mov    %esi,%eax
  8023f7:	d3 e8                	shr    %cl,%eax
  8023f9:	89 e9                	mov    %ebp,%ecx
  8023fb:	89 fa                	mov    %edi,%edx
  8023fd:	d3 e6                	shl    %cl,%esi
  8023ff:	09 d8                	or     %ebx,%eax
  802401:	f7 74 24 08          	divl   0x8(%esp)
  802405:	89 d1                	mov    %edx,%ecx
  802407:	89 f3                	mov    %esi,%ebx
  802409:	f7 64 24 0c          	mull   0xc(%esp)
  80240d:	89 c6                	mov    %eax,%esi
  80240f:	89 d7                	mov    %edx,%edi
  802411:	39 d1                	cmp    %edx,%ecx
  802413:	72 06                	jb     80241b <__umoddi3+0x10b>
  802415:	75 10                	jne    802427 <__umoddi3+0x117>
  802417:	39 c3                	cmp    %eax,%ebx
  802419:	73 0c                	jae    802427 <__umoddi3+0x117>
  80241b:	2b 44 24 0c          	sub    0xc(%esp),%eax
  80241f:	1b 54 24 08          	sbb    0x8(%esp),%edx
  802423:	89 d7                	mov    %edx,%edi
  802425:	89 c6                	mov    %eax,%esi
  802427:	89 ca                	mov    %ecx,%edx
  802429:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  80242e:	29 f3                	sub    %esi,%ebx
  802430:	19 fa                	sbb    %edi,%edx
  802432:	89 d0                	mov    %edx,%eax
  802434:	d3 e0                	shl    %cl,%eax
  802436:	89 e9                	mov    %ebp,%ecx
  802438:	d3 eb                	shr    %cl,%ebx
  80243a:	d3 ea                	shr    %cl,%edx
  80243c:	09 d8                	or     %ebx,%eax
  80243e:	83 c4 1c             	add    $0x1c,%esp
  802441:	5b                   	pop    %ebx
  802442:	5e                   	pop    %esi
  802443:	5f                   	pop    %edi
  802444:	5d                   	pop    %ebp
  802445:	c3                   	ret    
  802446:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80244d:	8d 76 00             	lea    0x0(%esi),%esi
  802450:	29 fe                	sub    %edi,%esi
  802452:	19 c3                	sbb    %eax,%ebx
  802454:	89 f2                	mov    %esi,%edx
  802456:	89 d9                	mov    %ebx,%ecx
  802458:	e9 1d ff ff ff       	jmp    80237a <__umoddi3+0x6a>
